I'm most likely doing something very wrong, but I can't figure out what.
In my custom rule, I'm checking the SyntaxKind of a Node to control my flow, like so:
import * as ts from "typescript"
function processPropertyName(pn: ts.PropertyName) {
switch (pn.kind) {
case ts.SyntaxKind.Identifier:
case ts.SyntaxKind.StringLiteral:
//doX
break
case ts.SyntaxKind.NumericLiteral:
//doY
break
}
}
I have installed typescript as a module this works fine when I'm developing and testing the rule. However, when I publish the package and use it in another project the SyntaxKind values are messed up. for example: NumericalLiteral has value 8 in my environment, but not in the consuming environment. Most likely because another version of the typescript package is used. But how can I make sure that the typescript package that I am importing in my rule file is the same as the one that is being used to parse the source file?
never mind, I found the solution :)