uiv icon indicating copy to clipboard operation
uiv copied to clipboard

Typescript support

Open qazxsw99 opened this issue 8 years ago • 5 comments

This is awesome project indeed. Is it possible to add definition file for Typescript since vue 2.5 have greatly improved on it.

qazxsw99 avatar Mar 14 '18 11:03 qazxsw99

I am not a TS user, and have no idea on how to implement this. contributions are very welcome :smile:

wxsms avatar Mar 14 '18 12:03 wxsms

I get this error when using typescript, "TS7016: Could not find a declaration file for module 'uiv'" Is it planned to add declaration files?

munozcotelo avatar Mar 22 '18 14:03 munozcotelo

There are so many libs without updated definitions in typescript. Use ambient declarations : declare module "uiv" { }

newuser avatar Jul 21 '18 07:07 newuser

For it to work properly following the project documentation with import * as uiv, I had to create declarations like this:

declare module 'uiv' {
  const uiv: any;
  export = uiv;
}

declare module 'uiv/src/locale/lang/pt-BR' {
  const locale: any;
  export default locale;
}

I'm not an expert with type declarations, otherwise I would happily contribute to the project...

matheusgrieger avatar Jul 28 '18 11:07 matheusgrieger

I use it as follows: First import the components with requiere

const uiv = require( "uiv" );
const Dropdown   = uiv.Dropdown;
const DatePicker = uiv.DatePicker;
const TimePicker = uiv.TimePicker;

Then, register them as components

new Vue( {
    components: {
        Dropdown,
        DatePicker,
        TimePicker
    }
} )

Hopefully this can help you

vilazae avatar Sep 25 '18 08:09 vilazae