Typescript writes d.ts files for js files. Do I have to put them together with js files?

wrote the d.ts file for the js file, want to put the d.ts file in the project under the unified directory typings, how to associate with the js file, how to make d.ts valid for other reference files, try from js reference d.ts useless, how to write?

Apr.26,2022

if the js file contains export, it is a module file. Refer to the ts official website declaration file module.d.ts template module.d.ts needs to be in the same directory as js.

so it should be required to be put together.

if it is a global variable, it can be directly declared by declare without special placement of the declaration file location.

Menu