मुख्य सामग्री पर जाएँ
Skillpedia
सामान्य कोडिंग7.8k · #13084

typescript-compile-check-resilient

यह क्या करती है

यह स्किल बताती है कि TypeScript कम्पाइलर को सीधे कैसे चलाएं और केवल नई या बदली गई फ़ाइलों की एरर दिखाएं। यह उन डेवलपर्स के लिए है जो पुरानी एरर वाले बड़े TypeScript प्रोजेक्ट में काम करते हैं।

कब इस्तेमाल करें

  • ✓जब आपके प्रोजेक्ट वातावरण में npx या TypeScript कमांड फेल हो।
  • ✓जब आपके प्रोजेक्ट में पहले से पुरानी टाइप एरर हैं जिनका आपके बदलाव से कोई लेना-देना नहीं।
  • ✓जब आप केवल अपनी नई फ़ाइलों के साफ़ कम्पाइल होने की पुष्टि चाहते हैं।

Skill का लिंक

https://github.com/HKUDS/AgentPilot/blob/main/openspace/legacy/v1/showcase/skills/typescript-compile-check-resilient/SKILL.md

इसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।

कैसे इस्तेमाल करें

सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।

पेस्ट करने के लिए तैयार मैसेज

इस skill से मेरी मदद करो: https://github.com/HKUDS/AgentPilot/blob/main/openspace/legacy/v1/showcase/skills/typescript-compile-check-resilient/SKILL.md इस लिंक की SKILL.md फ़ाइल पढ़ो और मेरे काम में उसके निर्देशों का पालन करो।
क्या आप चाहते हैं कि आपका AI ऐसी skills खुद ढूँढे?मुफ़्त Skillpedia MCP इंस्टॉल करें: बस एक लाइन, और हर काम से पहले यह 15,000+ skills में खोजता है।1 मिनट में इंस्टॉल करें →

AI से क्या माँगें: उदाहरण

“क्या आप जाँच सकते हैं कि आपकी अभी लिखी फ़ाइलें कम्पाइल होती हैं, और प्रोजेक्ट की बाकी पुरानी एरर को अनदेखा कर सकते हैं?”

हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।

यह कैसे काम करती है

एजेंट TypeScript कम्पाइलर को उसकी Node फ़ाइल के ज़रिए सीधे चलाता है, फिर आउटपुट को छानकर केवल नई या बदली फ़ाइलों की एरर दिखाता है।

तकनीकी सामग्री (मूल SKILL.md)

लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।

TypeScript Compile-Check (Resilient) with File-Scoped Error Filtering

Use this workflow when you need to validate TypeScript changes in a project but the standard npx tsc or node_modules/.bin/tsc invocations fail due to broken symlinks, missing PATH entries, or environment issues.


When to Use This Skill

  • npx tsc fails with "command not found" or permission errors
  • node_modules/.bin/tsc symlink is broken or unresolvable
  • You need to validate only newly-created or task-specific files without being blocked by pre-existing compile errors in the broader codebase

Step 1 — Invoke tsc Directly via node_modules

Bypass npx and symlinks entirely by calling the TypeScript binary directly:

node_modules/typescript/bin/tsc --noEmit 2>&1; echo EXIT:$?

Why this works: The tsc CLI entry point is a plain Node.js script at node_modules/typescript/bin/tsc. It does not depend on symlinks or PATH resolution. The --noEmit flag checks types without writing output files. Capturing EXIT:$? lets you programmatically detect success (EXIT:0) vs failure (EXIT:1 or higher).

If the project uses a custom tsconfig, specify it explicitly:

node_modules/typescript/bin/tsc --noEmit --project tsconfig.json 2>&1; echo EXIT:$?

Step 2 — Filter Output to Task-Specific Files Only

When a legacy codebase has pre-existing errors, the full tsc output will be noisy and may cause false negatives. Pipe through grep to isolate errors from only the files you created or modified:

node_modules/typescript/bin/tsc --noEmit 2>&1 \
  | grep -E "(file-pattern)" ; echo EXIT:${PIPESTATUS[0]}

Examples

Single new file:

node_modules/typescript/bin/tsc --noEmit 2>&1 \
  | grep -E "settings-store\.ts"

Multiple new files (pipe-delimited pattern):

node_modules/typescript/bin/tsc --noEmit 2>&1 \
  | grep -E "(settings-keys|settings-store|preferences|SettingsModal)"

All files in a specific directory:

node_modules/typescript/bin/tsc --noEmit 2>&1 \
  | grep -E "src/features/my-feature/"

Check: no output = no errors in your files (success).


Step 3 — Capture Exit Code Correctly Through a Pipe

When grepping, the shell exit code reflects grep, not tsc. Use ${PIPESTATUS[0]} (bash) to recover the original tsc exit code:

node_modules/typescript/bin/tsc --noEmit 2>&1 \
  | grep -E "(my-file-pattern)"; echo "TSC_EXIT:${PIPESTATUS[0]}"

Or store errors explicitly:

TSC_OUTPUT=$(node_modules/typescript/bin/tsc --noEmit 2>&1)
TSC_EXIT=$?
echo "$TSC_OUTPUT" | grep -E "(settings-keys|settings-store|preferences|SettingsModal)"
echo "TSC_EXIT:$TSC_EXIT"

The second approach (storing output in a variable) is the most reliable since $? is captured before the pipe.


Step 4 — Interpret Results

Condition Meaning
TSC_EXIT:0, no grep output ✅ Full project clean, your files are fine
TSC_EXIT:1, no grep output ✅ Your files are fine; pre-existing errors elsewhere (acceptable)
TSC_EXIT:1, grep output present ❌ Your files have errors — fix them
TSC_EXIT:2 ❌ tsc configuration error (bad tsconfig, missing typescript package)

Fallback: Verify TypeScript Is Installed

If node_modules/typescript/bin/tsc does not exist:

# Check if typescript is installed
ls node_modules/typescript/bin/tsc 2>/dev/null || echo "TypeScript not installed"

# Install if needed
npm install --save-dev typescript
# or
yarn add --dev typescript

Full Example

# Store full tsc output and exit code
TSC_OUTPUT=$(node_modules/typescript/bin/tsc --noEmit 2>&1)
TSC_EXIT=$?

# Show only errors in newly-created files
NEW_FILE_ERRORS=$(echo "$TSC_OUTPUT" | grep -E "(settings-keys|settings-store|preferences|SettingsModal)")

if [ -z "$NEW_FILE_ERRORS" ]; then
  echo "✅ No TypeScript errors in new files (TSC_EXIT:$TSC_EXIT)"
else
  echo "❌ TypeScript errors in new files:"
  echo "$NEW_FILE_ERRORS"
  exit 1
fi

Notes

  • This technique is safe for CI and local environments alike.
  • The direct node_modules/typescript/bin/tsc path works on macOS, Linux, and Windows (via node node_modules/typescript/bin/tsc on Windows CMD).
  • On Windows, replace the bash script with: node node_modules/typescript/bin/tsc --noEmit
  • Always prefer --noEmit for validation-only checks to avoid side effects.
अक्सर पूछे जाने वाले सवाल

कम्पाइलर सीधे क्यों चलाएं?

उसकी Node फ़ाइल के ज़रिए चलाने से लिंक और कमांड पाथ की वे समस्याएं टलती हैं जो सामान्य कमांड को तोड़ सकती हैं।

क्या मैं कोई खास कॉन्फ़िग फ़ाइल इस्तेमाल कर सकता हूं?

हां। जाँच प्रोजेक्ट की कॉन्फ़िग फ़ाइल की ओर इशारा कर सकती है, ताकि सही सेटिंग इस्तेमाल हों।

एजेंट कैसे जानता है कि जाँच पास हुई?

कमांड एक exit code प्रिंट करता है, जो एरर न होने पर शून्य होता है।

जानकारी

लेखक का मूल विवरण

TypeScript compile-checking in projects where npx and node_modules/.bin symlinks fail, with a filtering technique to isolate errors from only newly-created or task-specific files — ignoring pre-existing legacy errors.

repo: HKUDS/AgentPilot

लोकप्रियता

GitHub स्टार
7.8k
रैंकिंग में स्थान
#13084
लाइसेंस
MIT
अपडेट की गई
1/11/2026

क्या यह skill काम की है?

0

लॉग इन करें वोट करने के लिए।

कमेंट

  • …

इस repository की और skills

मिलती-जुलती skills