The TypeScript team announced the 7.1 Beta on October 20. One change lets ambient module declarations include import attributes, so a declaration can describe the type returned by a CSS, text, or bytes import.

declare module "*" with { type: "text" } {
  const content: string;
  export default content;
}

Why the beta feature matters

  • The declaration can require an attribute such as type: "text" rather than matching only a filename pattern.
  • The beta also includes source-phase import support, which the TypeScript post describes in the context of evolving JavaScript and WebAssembly module features.
  • The team notes that ambient declarations do not verify that a matching file exists on disk.

This is a beta release, not a reason to upgrade a production toolchain without testing. Confirm that your runtime and bundler support the same import syntax and behavior.

The official announcement includes details and limitations for each feature; libraries should avoid shipping global declarations that could conflict with an application's environment.