Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Debug Failure. False expression: length must be non-negative, is NaN #15

Open
YoshiWalsh opened this issue Oct 4, 2017 · 4 comments

Comments

@YoshiWalsh
Copy link

Using reflec-ts 0.3.9 with Node 8.6.0. I have the following basic project structure:

src/tests.js

class testClassA {
    a: string
}

console.log(new testClassA());

tsconfig.json

{
    "compileOnSave": true,
    "include": [
        "src/*"
    ],
    "compilerOptions": {
        "target": "ES2017",
        "noImplicitAny": true,
        "removeComments": false,
        "sourceMap": true,
        "outDir": "build"
    },
    "reflectionEnabled": true
}

I'm running this command:

node d:\git\test-project\node_modules\reflec-ts\bin\tsc -p d:\git\test-project

I get the following output:

d:\git\test-project\node_modules\reflec-ts\lib\tsc.js:53636
throw e;
^

Error: Debug Failure. False expression: length must be non-negative, is NaN
at Object.assert (d:\git\test-project\node_modules\reflec-ts\lib\tsc.js:2834:23)
at Object.createFileDiagnostic (d:\git\test-project\node_modules\reflec-ts\lib\tsc.js:2004:15)
at createDiagnosticForNodeInSourceFile (d:\git\test-project\node_modules\reflec-ts\lib\tsc.js:7304:19)
at Object.createDiagnosticForNode (d:\git\test-project\node_modules\reflec-ts\lib\tsc.js:7299:16)
at error (d:\git\test-project\node_modules\reflec-ts\lib\tsc.js:22449:22)
at resolveName (d:\git\test-project\node_modules\reflec-ts\lib\tsc.js:22891:25)
at getResolvedSymbol (d:\git\test-project\node_modules\reflec-ts\lib\tsc.js:29693:67)
at checkIdentifier (d:\git\test-project\node_modules\reflec-ts\lib\tsc.js:30742:26)
at checkExpressionWorker (d:\git\test-project\node_modules\reflec-ts\lib\tsc.js:34344:28)
at checkExpression (d:\git\test-project\node_modules\reflec-ts\lib\tsc.js:34328:42)
The terminal process terminated with exit code: 1

If I change reflectionEnabled to false in tsconfig.json then the build succeeds. Not sure what I'm doing wrong! It's weird because I've successfully used reflec-ts before, but it was on a different PC.

@pcan
Copy link
Owner

pcan commented Oct 6, 2017

Could you try the same code with a previous version of node (7.x)? At the moment I have no time to investigate this, but I suspect it's a backward-compatibility issue. Please note that I haven't merged the latest versions of the compiler, since I'm waiting for the official transformers API in order to build reflec-ts as a plugin (and not as a fork of the whole compiler like now).

@YoshiWalsh
Copy link
Author

I tried multiple node versions (8.2.1, which worked for me a few months ago on a different PC, 7.10.1 and 6.11.4 LTS) but just get the same error. Really weird! Anyway, I love Reflec-TS, totally understand about you not having the time. I'll keep trying things and let you know if I get it to work again.

Isn't the Transformers API public now though? microsoft/TypeScript#13764 Or are you waiting for something else?

@pcan
Copy link
Owner

pcan commented Oct 8, 2017

Isn't the Transformers API public now though? microsoft/TypeScript#13764 Or are you waiting for something else?

The API was made public some time ago, but there's no way to add Transformer plugins without modifying the tsc source code (see this issue).

In the meantime, you may try to change the compiler target (I see your config has ES2017), since I don't remember if I tested anything beyond ES6 as target.

@fuminchao
Copy link

Encountered same problem
reflec-tsc 2.2.1
node v6.11.2
target ES5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants