Skip to content

feat: Add empty types/index.d.ts file#225

Open
TSenter wants to merge 1 commit intoember-cli:mainfrom
TSenter:main
Open

feat: Add empty types/index.d.ts file#225
TSenter wants to merge 1 commit intoember-cli:mainfrom
TSenter:main

Conversation

@TSenter
Copy link
Copy Markdown

@TSenter TSenter commented Feb 26, 2026

It is often necessary for TypeScript projects to include ambient types, or to at least declare/override existing types (for example, an Embroider config). A few examples:

  1. Providing types for packages/addons not written in TypeScript
  2. Providing types for your own Embroider config options
declare module '@embroider/macros' {
  interface MyConfig {
    foo: string;
    bar?: boolean;
  }

  export function getOwnConfig(): MyConfig | undefined;
}

I consider this file akin to the unpublished-development-types/index.d.ts file provided by @ember/addon-blueprint. For example, in my company's @nrg-ui/core addon, we use these types for our own Embroider config, like so:

export interface EmbroiderConfig {
  appVersion: string;
  breakpoints: {
    xsmall: string;
    small: string;
    medium: string;
    large: string;
    xlarge: string;
    xxlarge: string;
  };
}

declare module '@embroider/macros' {
  export function getOwnConfig(): Partial<EmbroiderConfig> | undefined;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant