Coder Social home page Coder Social logo

Comments (3)

susnux avatar susnux commented on August 16, 2024 1

I think you can add something like this to your project in a global.d.ts:

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

from vue-material-design-icons.

VanGorg avatar VanGorg commented on August 16, 2024 1

@Howard-Lam-UnitedVanning
I just faced the same problem and got it working by declaring size and fillcolor as optional. So the file contents are now

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

from vue-material-design-icons.

Howard-Lam-UnitedVanning avatar Howard-Lam-UnitedVanning commented on August 16, 2024

@susnux I get the following error with your solution in the template
Argument of type '{}' is not assignable to parameter of type '{ readonly size: number; readonly fillColor: string; readonly title?: string | undefined; style?: unknown; key?: string | number | symbol | undefined; ref?: VNodeRef | undefined; ... 8 more ...; class?: unknown; } & Record<...>'.
Type '{}' is missing the following properties from type '{ readonly size: number; readonly fillColor: string; readonly title?: string | undefined; style?: unknown; key?: string | number | symbol | undefined; ref?: VNodeRef | undefined; ref_for?: boolean | undefined; ... 7 more ...; class?: unknown; }': size, fillColor

example : <ChevronUp />
and it shows on ChevronUp

from vue-material-design-icons.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.