Like writing a translated instruction manual for a tool that only came with one in another language.
declare module "my-lib" adds TypeScript types for a JavaScript package that doesn't ship its own types. TypeScript will use these declarations when you import from my-lib.
> import { init } from "my-lib" → fully typed
> No TypeScript source needed — only .d.ts
> File: node_modules/@types/my-lib/index.d.tsLike writing a translated instruction manual for a tool that only came with one in another language.
declare module "my-lib" adds TypeScript types for a JavaScript package that doesn't ship its own types. TypeScript will use these declarations when you import from my-lib.
> import { init } from "my-lib" → fully typed
> No TypeScript source needed — only .d.ts
> File: node_modules/@types/my-lib/index.d.tsSign in to cast your vote
Sign in to share your feedback and join the discussion.