File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change 22import ts from 'typescript/lib/tsserverlibrary'
33import { createLanguageService } from './typescript/src/dummyLanguageService'
44
5- let testString = 'const a: {/** @default test */a: 5} | {b: 6, /** yes */a: 9} = null as any;\nif ("||" in a) {}'
5+ globalThis . ts = ts
6+
7+ let testString = /* ts */ `
8+ const b = () => 5
9+ const a = b()|| as
10+ new Promise()
11+ `
612const replacement = '||'
713const pos = testString . indexOf ( replacement )
814testString = testString . slice ( 0 , pos ) + testString . slice ( pos + replacement . length )
@@ -16,7 +22,7 @@ const sourceFile = program?.getSourceFile(filePath)
1622if ( ! program || ! sourceFile ) throw new Error ( 'No source file' )
1723
1824const typeChecker = program . getTypeChecker ( )
19- const node = findChildContainingPosition ( ts , sourceFile , pos )
25+ let node = findChildContainingPosition ( ts , sourceFile , pos )
2026if ( ! node ) throw new Error ( 'No node' )
2127const type = typeChecker . getTypeAtLocation ( node )
2228
You can’t perform that action at this time.
0 commit comments