TypeStrong / atom-typescript

The only TypeScript package you will ever need
https://atom.io/packages/atom-typescript
MIT License
1.13k stars 205 forks source link

[bug] erroneous type errors #1487

Closed trusktr closed 4 years ago

trusktr commented 5 years ago

Here's a screenshot, notice that the tooltip shows a type error that has nothing to do with the line where it is showing the error:

screen shot 2019-01-16 at 3 16 05 pm

I don't know how to reproduce it. It just happens sometimes. The only way to recover is control+option+command+l to restart.

trusktr commented 5 years ago

The keyof in the screenshot is referring to the one in the lines above.

trusktr commented 5 years ago

Alright, now looks like I've reached an unrecoverable state. No matter how many times I restart Atom, I am no longer seeing any time information or errors at all, in the entire project. I haven't touched any configs, I've been editing only a single source file (the one in the screenshot above).

trusktr commented 5 years ago

Alright, strange, finally it shows something, and it seems to indicate I now have a ton of type errors all over my source files (which is wrong):

screen shot 2019-01-16 at 3 46 42 pm

trusktr commented 5 years ago

Don't know if it's related, but I'm seeing an errors like the following occurring in the console:

screen shot 2019-01-16 at 3 48 22 pm

continued:

screen shot 2019-01-16 at 3 48 49 pm

continued:

screen shot 2019-01-16 at 3 49 04 pm

 Save failed with error Error: Error processing request. Debug Failure. This is unknown parent for type parameter: 179
Error: Debug Failure. This is unknown parent for type parameter: 179
    at getTypeParameterConstraintVisibilityError (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:77951:37)
    at handleSymbolAccessibilityError (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:78091:33)
    at checkEntityNameVisibility (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:78423:13)
    at visitDeclarationSubtree (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:78602:25)
    at visitNodes (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:62269:48)
    at Object.visitEachChild (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:62384:109)
    at visitDeclarationSubtree (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:78603:39)
    at visitNode (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:62218:23)
    at Object.visitEachChild (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:62414:56)
    at visitDeclarationSubtree (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:78688:31)
    at visitNode (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:62218:23)
    at Object.visitEachChild (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:62354:112)
    at visitDeclarationSubtree (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:78660:43)
    at visitNode (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:62218:23)
    at Object.visitEachChild (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:62418:111)
    at visitDeclarationSubtree (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:78688:31)
    at Object.visitNode (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:62218:23)
    at transformTopLevelDeclaration (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:78784:190)
    at visitDeclarationStatements (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:78749:26)
    at Object.visitNodes (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:62269:48)
    at transformRoot (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:78193:33)
    at /Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:1379:42
    at transformRoot (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:79284:82)
    at Object.map (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:442:29)
    at Object.transformNodes (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:79271:30)
    at emitDeclarationFileOrBundle (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:80470:43)
    at emitSourceFileOrBundle (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:80411:13)
    at forEachEmittedFile (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:80317:30)
    at Object.emitFiles (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:80399:9)
    at emitWorker (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:85105:33)
    at /Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:85065:66
    at runWithCancellationToken (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:85157:24)
    at Object.emit (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:85065:20)
    at Object.getFileEmitOutput (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:86434:34)
    at updateShapeSignature (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:86614:37)
    at Object.getFilesAffectedBy (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:86573:18)
    at ConfiguredProject.Project.getCompileOnSaveAffectedFileList (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:118430:54)
    at /Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:122625:48
    at /Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:121338:119
    at Object.flatMap (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:499:25)
    at combineProjectOutput (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:121338:30)
    at IOSession.Session.getCompileOnSaveAffectedFileList (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:122620:24)
    at Session.handlers.ts.createMapFromTemplate._a.(anonymous function) (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:121649:61)
    at /Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:123062:88
    at IOSession.Session.executeWithRequestId (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:123053:28)
    at IOSession.Session.executeCommand (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:123062:33)
    at IOSession.Session.onMessage (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:123082:35)
    at Interface.<anonymous> (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:124345:27)
    at emitOne (events.js:116:13)
    at Interface.emit (events.js:211:7)
    at Interface._onLine (readline.js:282:10)
    at Interface._normalWrite (readline.js:424:12)
    at Socket.ondata (readline.js:141:10)
    at emitOne (events.js:116:13)
    at Socket.emit (events.js:211:7)
    at addChunk (_stream_readable.js:263:12)
    at readableAddChunk (_stream_readable.js:250:11)
    at Socket.Readable.push (_stream_readable.js:208:10)
    at Pipe.onread (net.js:594:20)
    at getTypeParameterConstraintVisibilityError (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:77951:37)
    at handleSymbolAccessibilityError (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:78091:33)
    at checkEntityNameVisibility (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:78423:13)
    at visitDeclarationSubtree (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:78602:25)
    at visitNodes (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:62269:48)
    at Object.visitEachChild (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:62384:109)
    at visitDeclarationSubtree (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:78603:39)
    at visitNode (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:62218:23)
    at Object.visitEachChild (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:62414:56)
    at visitDeclarationSubtree (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:78688:31)
    at visitNode (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:62218:23)
    at Object.visitEachChild (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:62354:112)
    at visitDeclarationSubtree (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:78660:43)
    at visitNode (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:62218:23)
    at Object.visitEachChild (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:62418:111)
    at visitDeclarationSubtree (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:78688:31)
    at Object.visitNode (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:62218:23)
    at transformTopLevelDeclaration (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:78784:190)
    at visitDeclarationStatements (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:78749:26)
    at Object.visitNodes (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:62269:48)
    at transformRoot (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:78193:33)
    at /Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:1379:42
    at transformRoot (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:79284:82)
    at Object.map (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:442:29)
    at Object.transformNodes (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:79271:30)
    at emitDeclarationFileOrBundle (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:80470:43)
    at emitSourceFileOrBundle (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:80411:13)
    at forEachEmittedFile (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:80317:30)
    at Object.emitFiles (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:80399:9)
    at emitWorker (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:85105:33)
    at /Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:85065:66
    at runWithCancellationToken (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:85157:24)
    at Object.emit (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:85065:20)
    at Object.getFileEmitOutput (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:86434:34)
    at updateShapeSignature (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:86614:37)
    at Object.getFilesAffectedBy (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:86573:18)
    at ConfiguredProject.Project.getCompileOnSaveAffectedFileList (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:118430:54)
    at /Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:122625:48
    at /Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:121338:119
    at Object.flatMap (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:499:25)
    at combineProjectOutput (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:121338:30)
    at IOSession.Session.getCompileOnSaveAffectedFileList (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:122620:24)
    at Session.handlers.ts.createMapFromTemplate._a.(anonymous function) (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:121649:61)
    at /Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:123062:88
    at IOSession.Session.executeWithRequestId (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:123053:28)
    at IOSession.Session.executeCommand (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:123062:33)
    at IOSession.Session.onMessage (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:123082:35)
    at Interface.<anonymous> (/Users/trusktr/src/Signafy+mapper-annotated-scene/node_modules/typescript/lib/tsserver.js:124345:27)
    at emitOne (events.js:116:13)
    at Interface.emit (events.js:211:7)
    at Interface._onLine (readline.js:282:10)
    at Interface._normalWrite (readline.js:424:12)
    at Socket.ondata (readline.js:141:10)
    at emitOne (events.js:116:13)
    at Socket.emit (events.js:211:7)
    at addChunk (_stream_readable.js:263:12)
    at readableAddChunk (_stream_readable.js:250:11)
    at Socket.Readable.push (_stream_readable.js:208:10)
    at Pipe.onread (net.js:594:20)
    at Callbacks.resolve (/Users/trusktr/src/trusktr+dotfiles/.atom/packages/atom-typescript/dist/client/callbacks.js:39:28)
    at TypescriptServiceClient.onResponse (/Users/trusktr/src/trusktr+dotfiles/.atom/packages/atom-typescript/dist/client/client.js:144:24)
    at MessageStream.TypescriptServiceClient.onMessage (/Users/trusktr/src/trusktr+dotfiles/.atom/packages/atom-typescript/dist/client/client.js:75:22)
    at emitOne (events.js:116:13)
    at MessageStream.emit (events.js:211:7)
    at addChunk (_stream_readable.js:263:12)
    at readableAddChunk (_stream_readable.js:250:11)
    at MessageStream.Readable.push (_stream_readable.js:208:10)
    at MessageStream.Transform.push (_stream_transform.js:147:32)
    at MessageStream._transform (/Users/trusktr/src/trusktr+dotfiles/.atom/packages/atom-typescript/dist/client/client.js:184:22)
    at MessageStream.Transform._read (_stream_transform.js:186:10)
    at MessageStream.Transform._write (_stream_transform.js:174:12)
    at doWrite (_stream_writable.js:387:12)
    at writeOrBuffer (_stream_writable.js:373:5)
    at MessageStream.Writable.write (_stream_writable.js:290:11)
    at LineStream.ondata (_stream_readable.js:639:20)
    at emitOne (events.js:116:13)
    at LineStream.emit (events.js:211:7)
    at addChunk (_stream_readable.js:263:12)
    at readableAddChunk (_stream_readable.js:250:11)
    at LineStream.Readable.push (_stream_readable.js:208:10)
    at LineStream.Transform.push (_stream_transform.js:147:32)
    at LineStream._pushBuffer (/Users/trusktr/src/trusktr+dotfiles/.atom/packages/atom-typescript/node_modules/byline/lib/byline.js:126:17)
    at LineStream._transform (/Users/trusktr/src/trusktr+dotfiles/.atom/packages/atom-typescript/node_modules/byline/lib/byline.js:117:8)
    at LineStream.Transform._read (_stream_transform.js:186:10)
    at LineStream.Transform._write (_stream_transform.js:174:12)
    at doWrite (_stream_writable.js:387:12)
    at writeOrBuffer (_stream_writable.js:373:5)
    at LineStream.Writable.write (_stream_writable.js:290:11)
    at Socket.ondata (_stream_readable.js:639:20)
    at emitOne (events.js:116:13)
    at Socket.emit (events.js:211:7)
    at addChunk (_stream_readable.js:263:12)
    at readableAddChunk (_stream_readable.js:250:11)
    at Socket.Readable.push (_stream_readable.js:208:10)
    at Pipe.onread (net.js:594:20)
trusktr commented 5 years ago

My typescript experience is totally borked. Restarted Atom completely (quit all windows, kill Atom) and still the same issues: erroneous errors, etc.

trusktr commented 5 years ago

Looks like

type PointGroups = {
  [key in keyof Pick<Layers, 'base1' | 'base1color'>]: THREE.Group
}

was the source of all problems. When I changed it to

type PointGroups = {
  [key in keyof Pick<typeof Layers, 'base1' | 'base1color'>]: THREE.Group
}

with the insertion of the typeof, everything went back to normal.

With out the typeof, looks like declaration: true option in tsconfig was causing the Layers name to be private from the module where I imported it from. For some reason atom-typescript couldn't cope while this type error existed.

The tsc compiler would tell me that it could not find the name Layers despite having imported it. Layers in the other module is defined as const Layers = ..., so it isn't a type.

But nonetheless, I don't think atom-typescript intends to become totally unusable when this case happens.

trusktr commented 5 years ago

I feel that declaration: true is broken anyways. For example, this issue (there's other ones too).

trusktr commented 5 years ago

Looks to be an edge case that atom-typescript (or the ts server?) isn't handling well when I'm incorrectly passing the const Layers into Pick which expects a type and hence typeof Layers worked.

lierdakil commented 5 years ago

Thanks for the report.

Long story short you've apparently run into https://github.com/Microsoft/TypeScript/issues/25456, which is obviously upstream bug.

Perhaps tsserver errors should probably be reported more visibly to avoid unnecessary confusion? I'll see what I can do with that.