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

0
5 comments

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);

0

I need creates files. If TypeScript installed I need create ts/tsx file, if not installed - js/jsx/vue.

Thanks.

0

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. 

0

Good. How I can check vue project? vue project can have .ts files. How I can search files by extension?

0

Please sign in to leave a comment.