How to make the type declared by d.ts take effect within the script tag of the html file

< H2 > problem description < / H2 >

Namespaces or global variables declared in the global.d.ts file do not take effect within the script tag of the html file

< H2 > the environmental background of the problem and what methods you have tried < / H2 >

individuals like vscode to cooperate with d.ts file"s intelligent completion function, so for their own files, they will write a d.ts file. In js file, intelligent completion works very well, but in the script tag of html file, intelligent completion does not appear the type declared in d.ts file

. < H2 > related codes < / H2 >
   

Feb.25,2022

doesn't seem to support it right now. If you want to use hints, why not extract this part of the code into a js and introduce script?


refer to https://ts.xcatliu.com/basics/declaration-files-sharpexport-1

this is a document that teaches you how to write .d.ts

Menu