Is it possible to define a structural search in IntelliJ to warn about the use of the native JavaScript String
class instead of the Typescript string
type? The typescript documentation recommends that you never use the native JavaScript types (see here).
Our team is going back and forth between Kotlin and Typescript code so it is easy to inadvertently use String
. I would want to detect this in places like function parameters, variables, and as fields in classes.
For some more clarity on what I am interested in doing:
class MyTypescriptClass {
myField: String; //Inspection would generate warning on this line.
anotherField: string; //Inspection would not generate warning on this line.
fun1(param: String) {} //Inspection would generate warning on this line.
fun2(param: string) {} //Inspection would not generate warning on this line.
}
Creating the short template String
should do it. Make sure the Match Case checkbox is checked.