Open dfiori opened 8 years ago
As far as I know this project hasn't used TypeScript in its history. Is this file something that we should be concerned about, or can you add it to your project because you're using TypeScript?
Yes, I'm using typescript and it needs definitions for classes/libraries I used in the project. As far as I know, the Definetly Typed github project is an open project to define those libraries which are not written in typescript (and so they don't have the .ts file to get definitions). They just create a .d.ts file which define the structure of the library classes and methods. Here there's the define for Vex: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/36d40a63a05b5cb3413737fbdf7c9a2a26f211fd/vex-js/vex-js.d.ts
Oh, thank you, I hadn't heard of Definitely Typed. Should I submit a PR over there to update the vex .d.ts for version 3?
I opened this issue in the meantime: https://github.com/DefinitelyTyped/DefinitelyTyped/issues/12951
Thanks for the heads up!
I think so, but I don't know very well how those file are manteined. Due it's a github project I think you can add some changes and add missing fields if you want. I tried to map the Vex '.js' files to extract the definition file, but I have not fully understand how library works. Unfortunately by now I have commented out my code where Vex is called, because Visual Studio does not compile a .NET project if there're TypeScript errors on the client side.
Can I BUMP this please? Having a great deal of trouble trying to incorporate vex-js and vex-dialog together in a dotnet core/typescript project. I have the 'vex-js' part coming in ok, along with a .d.ts file for typing, but there is nothing in that file describing the 'vex-dialog' side of things, and looking at the demos, thats what is mostly used? Reading the quickstart, it states using webpack/etc prohibits you from using the combined minified js file, so I added NPM entries for 'vex-js', 'vex-dialog', and '@types/vex-js'
I assumed I would do something like:
import * as vex from 'vex-js';
import 'vex-dialog';
vex.defaultOptions.className = 'vex-theme-os'; //this is fine
vex.dialog.confirm({... //this is not fine (nothing in the .d.ts for it)
NOTE: I apologise in advance; This is NOT really a vex issue, it is a webpack/d.ts issue, but after MUCH googling, I'm honestly at a loss as to the appropriate webpack/typescript (yet vex-js aware) place to post this.
What .d.ts file are you using? Apologies, I don't know much about TypeScript. The API is not large and I imagine it wouldn't be hard to get the type information somewhere.
https://github.com/tivnet/DefinitelyTyped/blob/master/types/vex-js/index.d.ts - this one? I think we need a PR over there for vex-dialog, then.
Is it possible/does it make sense to add a new types directory, e.g. types/vex-dialog/index.d.ts
?
Yes, that appears to be the .d.ts I have. I'm afraid I have been away from web-dev for a little while so I'm not 100% on the current VS+TS+NPM tooling chain, but the .d.ts was obtained from a separate npm package "@types/vex-js": "^2.3.29" I'm not aware how original products package their index.d.ts for npm deployment, sorry.
Can I bump this again, it is possible to include your own type definitions in your NPM Package, you just need to add the .d.ts file to your codebase and reference it in your package.json.
More on that here: http://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html
Once that is done you can request to have the definitions removed from DefinitelyTyped to avoid confusion.
Please add the TypeScript "*d.ts" file to define Vex. Without them the compiler notice error and won't compile the .ts On DefinitelyTyped github page there's only a partial define, which does not include any reference for vex.dialogs class/file