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 2
2
import ts from 'typescript/lib/tsserverlibrary'
3
3
import { createLanguageService } from './typescript/src/dummyLanguageService'
4
4
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
+ `
6
12
const replacement = '||'
7
13
const pos = testString . indexOf ( replacement )
8
14
testString = testString . slice ( 0 , pos ) + testString . slice ( pos + replacement . length )
@@ -16,7 +22,7 @@ const sourceFile = program?.getSourceFile(filePath)
16
22
if ( ! program || ! sourceFile ) throw new Error ( 'No source file' )
17
23
18
24
const typeChecker = program . getTypeChecker ( )
19
- const node = findChildContainingPosition ( ts , sourceFile , pos )
25
+ let node = findChildContainingPosition ( ts , sourceFile , pos )
20
26
if ( ! node ) throw new Error ( 'No node' )
21
27
const type = typeChecker . getTypeAtLocation ( node )
22
28
You can’t perform that action at this time.
0 commit comments