Typescript: Debug Failure. False expression in TS 2.9

Created on 1 Jun 2018  Β·  10Comments  Β·  Source: microsoft/TypeScript


TypeScript Version: 2.9.1


Search Terms: Module build failed: Error: Debug Failure. False expression. lastLocation.kind 273

Code

// hard to do a *self-contained* demonstration of the problem :(

Expected behavior:
Should compile without fail :)

Actual behavior:
Just updated typescript from 2.8.4 to 2.9.1 and got this error:

ERROR in ./node_modules/2gl/src/Buffer.js
Module build failed: Error: Debug Failure. False expression.
    at resolveNameHelper (path\node_modules\typescript\lib\typescript.js:27846:30)
    at resolveName (path\node_modules\typescript\lib\typescript.js:27600:20)
    at resolveEntityName (path\node_modules\typescript\lib\typescript.js:28415:26)
    at resolveEntityName (path\node_modules\typescript\lib\typescript.js:28423:35)
    at resolveTypeReferenceName (path\node_modules\typescript\lib\typescript.js:33678:20)
    at getTypeFromTypeReference (path\node_modules\typescript\lib\typescript.js:33839:30)
    at getTypeFromTypeNode (path\node_modules\typescript\lib\typescript.js:35132:28)
    at Object.map (path\node_modules\typescript\lib\typescript.js:2025:29)
    at getTypeFromUnionTypeNode (path\node_modules\typescript\lib\typescript.js:34271:54)
    at getTypeFromTypeNode (path\node_modules\typescript\lib\typescript.js:35144:28)
    at getTypeOfVariableOrParameterOrProperty (path\node_modules\typescript\lib\typescript.js:30950:41)
    at getTypeOfSymbol (path\node_modules\typescript\lib\typescript.js:31174:24)
    at checkPropertyAccessExpressionOrQualifiedName (path\node_modules\typescript\lib\typescript.js:42269:53)
    at checkPropertyAccessExpression (path\node_modules\typescript\lib\typescript.js:42224:20)
    at checkExpressionWorker (path\node_modules\typescript\lib\typescript.js:45590:28)
    at checkExpression (path\node_modules\typescript\lib\typescript.js:45536:42)
    at checkExpressionWithContextualType (path\node_modules\typescript\lib\typescript.js:45371:26)
    at checkApplicableSignature (path\node_modules\typescript\lib\typescript.js:43018:25)
    at chooseOverload (path\node_modules\typescript\lib\typescript.js:43510:26)
    at resolveCall (path\node_modules\typescript\lib\typescript.js:43420:26)
    at resolveCallExpression (path\node_modules\typescript\lib\typescript.js:43635:20)
    at resolveSignature (path\node_modules\typescript\lib\typescript.js:43871:28)
    at getResolvedSignature (path\node_modules\typescript\lib\typescript.js:43914:26)
    at checkCallExpression (path\node_modules\typescript\lib\typescript.js:44001:29)
    at checkExpressionWorker (path\node_modules\typescript\lib\typescript.js:45599:28)
    at checkExpression (path\node_modules\typescript\lib\typescript.js:45536:42)
    at path\node_modules\typescript\lib\typescript.js:42679:21
    at Object.forEach (path\node_modules\typescript\lib\typescript.js:1792:30)
    at resolveUntypedCall (path\node_modules\typescript\lib\typescript.js:42678:20)
    at resolveErrorCall (path\node_modules\typescript\lib\typescript.js:42685:13)
    at resolveCallExpression (path\node_modules\typescript\lib\typescript.js:43604:24)
    at resolveSignature (path\node_modules\typescript\lib\typescript.js:43871:28)
    at getResolvedSignature (path\node_modules\typescript\lib\typescript.js:43914:26)
    at checkCallExpression (path\node_modules\typescript\lib\typescript.js:44001:29)
    at checkExpressionWorker (path\node_modules\typescript\lib\typescript.js:45599:28)
    at checkExpression (path\node_modules\typescript\lib\typescript.js:45536:42)
     @ ./src/map/gpuStorage.ts 3:0-32 114:25-31 115:26-32
     @ ./src/map/index.ts
     @ ./src/map/ui.ts
     @ ./src/index.ts

We use webpack@4 with ts-loader@4 and got this error. It happens with node8 and node10 on windows, macos and linux. It compiles without error in typescript 2.8, 2.7 etc.

I went to resolveNameHelper (node_modulestypescriptlibtypescript.js:27843) and find the assert line:

 ts.Debug.assert(lastLocation.kind === 273 /* SourceFile */);

I've added a condition before it:

if (lastLocation.kind !== 273) {
    console.log(lastLocation.kind);
}

And got 296. I don't know what it means but tell me how I can help further.

Bug Fixed

Most helpful comment

Fix should be in typescript@next today, can you give this a quick try and confirm that it is indeed fixed?

All 10 comments

That kind is JSDocTypedefTag, so the error probably involves a @typedef somewhere in your code.

Yeah, removing @typedef from ./node_modules/2gl/src/Buffer.js fix the problem - Compiled successfully

I'm getting the same error, but I have no idea how to fix it. I do not have any @typedef in the code.

I also just started getting this error after updating from 2.8.4 to 2.9.1, and I am using webpack 4 with tsloader.

This is the error I'm getting:

ERROR in ./src/index.ts
    Module build failed: Error: Debug Failure. False expression.
        at forEachIdentifierInEntityName (/Users/ddomingo/projects/mpe-plugin/node_modules/typescript/lib/typescript.js:24094:26)
        at bindPropertyAssignment (/Users/ddomingo/projects/mpe-plugin/node_modules/typescript/lib/typescript.js:24044:17)
        at bindStaticPropertyAssignment (/Users/ddomingo/projects/mpe-plugin/node_modules/typescript/lib/typescript.js:24029:13)
        at bindSpecialPropertyAssignment (/Users/ddomingo/projects/mpe-plugin/node_modules/typescript/lib/typescript.js:24020:17)
        at bindWorker (/Users/ddomingo/projects/mpe-plugin/node_modules/typescript/lib/typescript.js:23669:29)
        at bind (/Users/ddomingo/projects/mpe-plugin/node_modules/typescript/lib/typescript.js:23560:13)
        at visitNode (/Users/ddomingo/projects/mpe-plugin/node_modules/typescript/lib/typescript.js:14777:24)
        at Object.forEachChild (/Users/ddomingo/projects/mpe-plugin/node_modules/typescript/lib/typescript.js:15021:24)
        at bindEachChild (/Users/ddomingo/projects/mpe-plugin/node_modules/typescript/lib/typescript.js:22352:16)
        at bindChildrenWorker (/Users/ddomingo/projects/mpe-plugin/node_modules/typescript/lib/typescript.js:22434:21)
        at bindChildren (/Users/ddomingo/projects/mpe-plugin/node_modules/typescript/lib/typescript.js:22322:17)
        at bind (/Users/ddomingo/projects/mpe-plugin/node_modules/typescript/lib/typescript.js:23571:21)
        at /Users/ddomingo/projects/mpe-plugin/node_modules/typescript/lib/typescript.js:22328:94
        at bindEach (/Users/ddomingo/projects/mpe-plugin/node_modules/typescript/lib/typescript.js:22344:21)
        at bindEachFunctionsFirst (/Users/ddomingo/projects/mpe-plugin/node_modules/typescript/lib/typescript.js:22328:13)
        at bindChildrenWorker (/Users/ddomingo/projects/mpe-plugin/node_modules/typescript/lib/typescript.js:22426:21)
        at bindChildren (/Users/ddomingo/projects/mpe-plugin/node_modules/typescript/lib/typescript.js:22322:17)
        at bindContainer (/Users/ddomingo/projects/mpe-plugin/node_modules/typescript/lib/typescript.js:22270:17)
        at bind (/Users/ddomingo/projects/mpe-plugin/node_modules/typescript/lib/typescript.js:23574:21)
        at bindSourceFile (/Users/ddomingo/projects/mpe-plugin/node_modules/typescript/lib/typescript.js:21935:17)
        at Object.bindSourceFile (/Users/ddomingo/projects/mpe-plugin/node_modules/typescript/lib/typescript.js:21876:9)
        at initializeTypeChecker (/Users/ddomingo/projects/mpe-plugin/node_modules/typescript/lib/typescript.js:51156:20)
        at Object.createTypeChecker (/Users/ddomingo/projects/mpe-plugin/node_modules/typescript/lib/typescript.js:27045:9)
        at Object.getTypeChecker (/Users/ddomingo/projects/mpe-plugin/node_modules/typescript/lib/typescript.js:78949:79)
        at synchronizeHostData (/Users/ddomingo/projects/mpe-plugin/node_modules/typescript/lib/typescript.js:107271:21)
        at Object.getEmitOutput (/Users/ddomingo/projects/mpe-plugin/node_modules/typescript/lib/typescript.js:107671:13)
        at Object.getEmitOutput (/Users/ddomingo/projects/mpe-plugin/node_modules/ts-loader/dist/instances.js:184:41)
        at getEmit (/Users/ddomingo/projects/mpe-plugin/node_modules/ts-loader/dist/index.js:196:37)
        at successLoader (/Users/ddomingo/projects/mpe-plugin/node_modules/ts-loader/dist/index.js:34:11)
        at Object.loader (/Users/ddomingo/projects/mpe-plugin/node_modules/ts-loader/dist/index.js:21:12)

Fix should be in typescript@next today, can you give this a quick try and confirm that it is indeed fixed?

Yeah! That worked πŸ˜ƒ

We have this same issue reported to us and I can reproduce locally with Typescript 2.9.2, 2.9.1 and even 3.0.0-dev*. But on 2.8.4 everything works fine.

ERROR in ./node_modules/ably/browser/static/ably-commonjs.js
Module build failed (from ./node_modules/ts-loader/index.js):
Error: Debug Failure. False expression.
    at getJSDocTags (/Users/mattheworiordan/Projects/Ably/forks/ably-webpack-typescript/node_modules/typescript/lib/typescript.js:13197:22)
    at getFirstJSDocTag (/Users/mattheworiordan/Projects/Ably/forks/ably-webpack-typescript/node_modules/typescript/lib/typescript.js:13205:24)
    at Object.getJSDocTypeTag (/Users/mattheworiordan/Projects/Ably/forks/ably-webpack-typescript/node_modules/typescript/lib/typescript.js:13154:19)
    at checkParenthesizedExpression (/Users/mattheworiordan/Projects/Ably/forks/ably-webpack-typescript/node_modules/typescript/lib/typescript.js:45628:56)
    at checkExpressionWorker (/Users/mattheworiordan/Projects/Ably/forks/ably-webpack-typescript/node_modules/typescript/lib/typescript.js:45676:28)
    at checkExpression (/Users/mattheworiordan/Projects/Ably/forks/ably-webpack-typescript/node_modules/typescript/lib/typescript.js:45609:42)
    at checkBinaryLikeExpression (/Users/mattheworiordan/Projects/Ably/forks/ably-webpack-typescript/node_modules/typescript/lib/typescript.js:45155:29)
    at checkBinaryExpression (/Users/mattheworiordan/Projects/Ably/forks/ably-webpack-typescript/node_modules/typescript/lib/typescript.js:45147:20)
    at checkExpressionWorker (/Users/mattheworiordan/Projects/Ably/forks/ably-webpack-typescript/node_modules/typescript/lib/typescript.js:45702:28)
    at checkExpression (/Users/mattheworiordan/Projects/Ably/forks/ably-webpack-typescript/node_modules/typescript/lib/typescript.js:45609:42)

Sadly no reference is given to the location of the False expression, and no @typedef is used in ably-commonjs.js.

@mhegazy do you have any suggestions on how we can try and identify what part of the file is causing this issue so that we can fix / raise a suitable issue?

@mattheworiordan That has nothing in common with this issue besides being an assertion failure, so I made a new issue for it: #24963

Thanks!
On Thu, 14 Jun 2018 at 19:51, Andy notifications@github.com wrote:

@mattheworiordan https://github.com/mattheworiordan That has nothing in
common with this issue besides being an assertion failure, so I made a new
issue for it: #24963
https://github.com/Microsoft/TypeScript/issues/24963

β€”
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/Microsoft/TypeScript/issues/24577#issuecomment-397400854,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AACrDdziUJW2wcyCVB0UExIJh03vMcf-ks5t8rDMgaJpZM4UXDgD
.

I have this problem using:

info "[email protected]" has binaries:
   - tsc
   - tsserver
✨  Done in 4.58s.

It happens on a file where I use both require.requireActual() and import (cause it's a Jest mock file)

@chris-fran Could you create a new issue and provide a sample file that will reproduce it?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Roam-Cooper picture Roam-Cooper  Β·  3Comments

blendsdk picture blendsdk  Β·  3Comments

uber5001 picture uber5001  Β·  3Comments

MartynasZilinskas picture MartynasZilinskas  Β·  3Comments

zhuravlikjb picture zhuravlikjb  Β·  3Comments