Open hamirmahal opened 2 years ago
It doesn't have it because it was never implemented. You could try out project.getProgram().compilerObject.isSourceFileDefaultLibrary(sourceFile.compilerNode)
and see if it works, but I'm not sure if it will because ts-morph does some custom stuff. It might be more reliable to see if getFilePath()
contains "/node_modules/typescript/lib/".
On a sidenote, how do you feel about creating a Discussions section for more discussion-based questions like this one?
I tried discussions and I don't like it. It creates two places to check instead of just one.
Thanks @dsherret
I just tried:
identifier.getProject().getProgram().compilerObject.isSourceFileDefaultLibrary(identifier.getType().getSymbol().getDeclarations()[0].getSourceFile().compilerNode)
and it is working fine. Hopefully this function would have native support by ts-morph.
microsoft/TypeScript/src/compiler/program.ts
has aisSourceFileDefaultLibrary
function
.I was just curious: why does this repository have
isSourceFileFromExternalLibrary
, but notisSourceFileDefaultLibrary
?On a sidenote, how do you feel about creating a Discussions section for more discussion-based questions like this one?