0

My JavaScript code makes heavy use of globals for jQuery widgets.

Right now I am declaring type definitions in .d.ts files which I store in a customTypes directory.

Is there a way to declare these type definitions within the jQuery widget files themselves and therefore not have two files to modify everytime I need to modify the widget.

Thanks!

1 Answer 1

1

Javascript does not know about Typescript type definitions. You would have to write your jQuery widgets with Typescript. Then you can set a flag (-d or --declaration) in your typescript compiler options to create a type definition file. That way you would not have to update the definitions every time you change the code.

Sign up to request clarification or add additional context in comments.

2 Comments

I mean my jQuery widgets are now. ts files (Im porting JS to TS) so could I write definitions in there?
If your jQuery widgets are in Typescript, then you have no problem. Just add the -d flag o your compiler options and the TypeScript compiler will create the declaration files for you.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.