-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeScript support #267
Comments
I think you can add something like this to your project in a declare module 'vue-material-design-icons/*.vue' {
import type { DefineComponent } from 'vue'
const IconVue : DefineComponent<
{
/// `size` defaults to 24
size: number,
/// `fillColor` defaults to 'currentColor'
fillColor: string,
title?: string,
}>
export default IconVue
} Should work with vue 2.7 and vue 3 |
@susnux I get the following error with your solution in the template example : |
@Howard-Lam-UnitedVanning declare module 'vue-material-design-icons/*.vue' {
import type { DefineComponent } from 'vue';
const IconVue: DefineComponent<{
/// `size` defaults to 24
size?: number;
/// `fillColor` defaults to 'currentColor'
fillColor?: string;
title?: string;
}>;
export default IconVue;
} Calling this file 'global.d.ts' strangely didn't work. It only worked after I prefixed it with 'shims'; now it is called 'shims-vue-mat-icons.d.ts' and sits at project root. This way, things finally work out without errors. Thanks for your suggestion, @susnux |
It would be very beneficial to add TypeScript support via a declaration file. I'm currently working on a TypeScript-based Vue.js application. Personally, I feel much more comfortable with TS than with simple JS and I believe I can also support other application developers when they think about using this shared component library.
The text was updated successfully, but these errors were encountered: