Answer the question
In order to leave comments, you need to log in
How to declare a module in TypeScript?
This is the first time I've encountered this problem, and I don't really understand how it is solved. Found something like:
jquery.d.ts
declare let $: JQuery;
export default $;
, declare module 'mongoose-beautiful-unique-validation';
export default require('mongoose-beautiful-unique-validation');
Answer the question
In order to leave comments, you need to log in
It is possible to prescribe the source of typings in tsconfig.json. It will be more convenient to create some directory in the root, for example typings, and put all custom *.d.ts files in it. However,
the problem here is that this will remove support for other typings from ` @types/* ` and will need to be added to the array manually.
{
"compilerOptions": {
"typeRoots" : ["./node_modules/@types", "./typings"]
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question