Detecting if project with typescript
Answered
I develop plugin for WebStorm and I need detect using typescript. How I can do this? I can find tsconfig file, but maybe other way exists. thanks
Please sign in to leave a comment.
Hi,
What do you mean by detecting using Typescript? What is your exact use case?
If you mean checking if a project contains any Typescript files, you can use
com.intellij.psi.search.FileTypeIndex.containsFileOfType(TypescriptFileType.INSTANCE, scope);
I need creates files. If TypeScript installed I need create ts/tsx file, if not installed - js/jsx/vue.
Thanks.
Hello. I believe detecting tsconfig is the best strategy, since files with extension "ts" can be in node_modules. Another solution could be check "typescript" dependency in package.json but it is a less reliable way.
Thanks.
Good. How I can check vue project? vue project can have .ts files. How I can search files by extension?