Skip to content

[BUG] Error: Debug Failure. Invalid cast. The supplied value [object Object] did not pass the test 'isJsonSourceFile'. #28762

@magic-akari

Description

@magic-akari

TypeScript Version: 3.2.1

Search Terms:

Code

declare global {
  const React: typeof import("react");
  const ReactDOM: typeof import("react-dom");
}

export {};

Expected behavior:

Actual behavior:

> tsc

/Users/akari/Developer/test/node_modules/typescript/lib/tsc.js:71026
                throw e;
                ^

Error: Debug Failure. Invalid cast. The supplied value [object Object] did not pass the test 'isJsonSourceFile'.
    at Object.cast (/Users/akari/Developer/test/node_modules/typescript/lib/tsc.js:1158:22)
    at getTypeOfVariableOrParameterOrPropertyWorker (/Users/akari/Developer/test/node_modules/typescript/lib/tsc.js:29354:41)
    at getTypeOfVariableOrParameterOrProperty (/Users/akari/Developer/test/node_modules/typescript/lib/tsc.js:29334:48)
    at getTypeOfSymbol (/Users/akari/Developer/test/node_modules/typescript/lib/tsc.js:29603:24)
    at resolveImportSymbolType (/Users/akari/Developer/test/node_modules/typescript/lib/tsc.js:33159:45)
    at getTypeFromImportTypeNode (/Users/akari/Developer/test/node_modules/typescript/lib/tsc.js:33141:25)
    at getTypeFromTypeNode (/Users/akari/Developer/test/node_modules/typescript/lib/tsc.js:33460:28)
    at checkImportType (/Users/akari/Developer/test/node_modules/typescript/lib/tsc.js:43996:13)
    at checkSourceElement (/Users/akari/Developer/test/node_modules/typescript/lib/tsc.js:46921:28)

Playground Link:
https://gist.github.com/magic-akari/aa10dfb809268eb4f63d5749d113a93a

Related Issues:

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScript

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions