@type-zen/ts-plugin v0.1.0
TypeScript Plugin for TypeZen

English | 简体中文
Features
Use types exported from
*.tzenfiles in*.tsfilesShow related information when hovering over types exported from
*.tzenfiles...in development, stay tuned!
Installation
npm install @type-zen/ts-plugin -DUsage
Import the plugin in
tsconfig.json{ "compilerOptions": { "plugins": [{ "name": "@type-zen/ts-plugin" }] } }Configure your editor
Set the TypeScript version used in your project to the version in
node_modules/typescript/lib.VSCode
Use the
Select TypeScript versioncommand to switch TypeScript versions....
Issues
When using
tscor other tools to perform type checking, the errorCannot use namespace '...' as a typeis promptedAnswer: This is because
tscand other tools do not load plugins during type checking, and therefore cannot recognize types exported from*.tzenfiles. For discussions related to this issue, please refer to TypeScript#16607.Solution: Compile the
*.tzenfiles to generate the corresponding type declaration files (.d.tsfiles) before runningtscor other tools to perform type checking. This way,tscor other tools can recognize the type declarations from*.tzenfiles.When performing certain operations on types exported from
*.tzenfiles in*.tsfiles (e.g., finding references, jumping to definitions, etc.), the associated positions may not be correct.Answer: This is due to certain internal mechanisms of TS Server, which still need to be studied in depth... (no solution yet)
CHANGELOG
License
MIT License © 2023-PRESENT xlboy
3 years ago
3 years ago