Skip to content

How to declare module type for Typescript? #19

Closed
@BoldyrevDA

Description

@BoldyrevDA

There are different ways to import css by rollup-plugin-import-css.

So, this way

import styles from "./styles.css"; /* import the styles as a string */

I described in declaration.d.ts as

declare module "*.css" {
   const css: string;
   export default css;
}

But is there way to declare import with assertion?

import styles from "./styles.css" assert { type: "css" }; /* import the styles as a CSSStyleSheet */

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions