원클릭으로
editor-interrogation
Use when debugging type inference. Use when types behave unexpectedly. Use when learning unfamiliar code.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Use when debugging type inference. Use when types behave unexpectedly. Use when learning unfamiliar code.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Use when defining global types. Use when augmenting window. Use when typing environment variables. Use when working with build-time constants. Use when configuring type definitions.
Use when migrating JavaScript to TypeScript. Use when gradually adopting TypeScript. Use when working with mixed codebases. Use when converting large projects. Use when teams are learning TypeScript.
Use when writing asynchronous code. Use when tempted to use callbacks. Use when composing multiple async operations.
Use when creating types from example data. Use when types don't match all cases. Use when API responses vary.
Use when writing type annotations on variables. Use when TypeScript can infer the type. Use when code feels cluttered with types.
Use when defining array-like types. Use when tempted to use number as index type. Use when understanding array keys.
| name | editor-interrogation |
| description | Use when debugging type inference. Use when types behave unexpectedly. Use when learning unfamiliar code. |
Your editor is your best TypeScript learning tool.
TypeScript's language services provide autocomplete, inspection, navigation, and refactoring. These aren't just conveniences - they're the primary way to understand what TypeScript thinks about your code.
ALWAYS hover to verify types when behavior is unexpected.
Remember:
Check types when:
// 1. Type inference seems wrong
const num = 10; // Hover: what's the type?
const str = "hello"; // Is it string or literal "hello"?
// 2. Function returns don't match expectations
function add(a: number, b: number) {
return a + b;
}
// Hover over `add` - is return type number?
// 3. Narrowing isn't working as expected
function process(x: string | null) {
if (x) {
x // Hover here - should be string, not string | null
}
}
const list = [1, 2, 3];
// ^? const list: number[]
const tuple = [1, 2, 3] as const;
// ^? const tuple: readonly [1, 2, 3]
const result = "a,b,c"
.split(",") // Hover: Array<string>
.map(Number) // Hover: number[]
.filter(n => n > 0); // Hover: number[]
function example(x: string | number | null) {
if (typeof x === "string") {
x // Hover: string
} else if (x) {
x // Hover: number
} else {
x // Hover: number | null
}
}
Explore external types:
// Click "Go to Definition" on fetch
const response = await fetch('/api');
// Takes you to lib.dom.d.ts:
// declare function fetch(
// input: RequestInfo | URL, init?: RequestInit
// ): Promise<Response>;
// Click through RequestInit to see all options:
// interface RequestInit {
// body?: BodyInit | null;
// cache?: RequestCache;
// headers?: HeadersInit;
// ...
// }
Rename understands scope:
let i = 0;
for (let i = 0; i < 10; i++) { // Rename this i
console.log(i); // This updates
{
let i = 12; // This stays unchanged
console.log(i);
}
}
console.log(i); // This stays unchanged
function getElement(x: string | HTMLElement | null) {
if (typeof x === 'object') {
x // Hover: HTMLElement | null (not just HTMLElement!)
// typeof null === 'object' in JavaScript
}
}
interface Config {
name?: string;
}
const config: Config = {};
config.name // Hover: string | undefined
const arr = [1, 2, 3];
arr[10] // Hover: number (not number | undefined!)
// Unless noUncheckedIndexedAccess is enabled
Pressure: "I don't need to hover, I know it's a string"
Response: Assumptions cause bugs. The editor shows truth.
Action: Hover anyway. 2 seconds to verify.
Pressure: "I can't understand these generic types"
Response: Click through one piece at a time. Follow the breadcrumbs.
Action: Use "Go to Definition" iteratively.
| Action | VS Code Shortcut |
|---|---|
| Hover for type | Mouse over symbol |
| Go to Definition | F12 or Cmd/Ctrl+Click |
| Find All References | Shift+F12 |
| Rename Symbol | F2 |
| Quick Fix | Cmd/Ctrl+. |
Your editor knows more about your types than you do.
When types behave unexpectedly, don't guess - inspect. Hover over symbols, follow definitions, and watch how types narrow. This builds intuition faster than any documentation.
Based on "Effective TypeScript" by Dan Vanderkam, Item 6: Use Your Editor to Interrogate and Explore the Type System.