Declare Module for JavaScript Module in TypeScript | ATLASSC.NET
Skip to main content
/// .DATA.FRAGMENT_20220819

Declare Module for JavaScript Module in TypeScript

1 minAuthor: Z.SHINCHVEN

Some JavaScript code doesn't come with type declarations. In order to use them in TypeScript project, we can declare the module ourselves in a <MODULE_NAME>.d.ts file.

declare module 'my-module' {
    export type MyType = string;
    const MyType: {
        show: () => void,
    }
    export default MyType;
}
RackNerd Billboard Banner
Share node:
/// .RELATED.DATA_STREAMSShared tags

Related posts

Scanning_database_for_correlations…

/// .UPLINK.SUBSCRIBE

Keep your deck synced with every new transmission from ATLASSC.NET. Subscribe over RSS or Atom, or wire the whole archive straight into your AI assistant with the MCP server.