"매 .d.ts = type-only public surface — runtime code 의 X.". 매 TypeScript의 매 declaration 파일이 매 JS library의 매 type contract 의 제공 — @types/node, @types/react 등 매 DefinitelyTyped 가 매 ecosystem 의 backbone. 매 modern (2024-2026) 워크플로우는 tsc --declaration 자동 생성 + tsup / rollup-plugin-dts 의 bundling.
매 핵심
매 file types
lib.d.ts — TS standard library (DOM, ES2024).
package.d.ts — package 자체 type.
globals.d.ts — ambient declaration (window 확장).
module.d.ts — declare module 'foo' shape.
매 publishing
package.json"types" (or "typings") field → main d.ts entry.
// types/globals.d.ts
declareglobal{interfaceWindow{analytics?:{track(event: string,props?: Record<string,unknown>):void};}}export{};// make this a module