Skip to content

Typescript declarations for css class names #30

Description

@rebior

Hi,
I like that projects and I'm using the web font in a typescript project to create dynamic content. Therefore I have to set the css class names from my script. I created a script that extracts the icon names into a mdi.d.ts file so I can use it easily in my code with support of the IDE. The generated mdi.d.ts exports a single type that matches the icon names:

export type IconClass =
"mdi-ab-testing" |
"mdi-abacus" |
"mdi-abjad-arabic" |
 ...
"mdi-zodiac-virgo" |
"mdi-blank";

This type can then also be used for strongly typed interfaces. The import must be a "type only" import:

import type { IconClass } from "./mdi.js"

It would be nice if such a declaration for typescript could be added to @mdi/font with the types field in package.config pointing to it.

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