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
Verbose Debug Information: Node 94 (NullKeyword) was unexpected on typescript 2.1.1 #12684
Comments
Does it work with tsloader? |
@aluanhaddad same error with tsloader@1.3.0. ts-loader: Using typescript@2.2.0-dev.20161206 and /Users/zhouweiming/data/project/iermu_opssite/src/tsconfig.json
Error: Debug Failure. False expression: Unexpected node.
Verbose Debug Information: Node 94 (NullKeyword) was unexpected.
at Object.assert (/Users/zhouweiming/data/project/iermu_opssite/src/node_modules/.typescript@2.2.0-dev.20161206/lib/typescript.js:3177:23)
at Object.Debug.failBadSyntaxKind (/Users/zhouweiming/data/project/iermu_opssite/src/node_modules/.typescript@2.2.0-dev.20161206/lib/typescript.js:44765:55)
at serializeTypeNode (/Users/zhouweiming/data/project/iermu_opssite/src/node_modules/.typescript@2.2.0-dev.20161206/lib/typescript.js:46715:30)
at serializeTypeNode (/Users/zhouweiming/data/project/iermu_opssite/src/node_modules/.typescript@2.2.0-dev.20161206/lib/typescript.js:46683:56)
at serializeTypeOfNode (/Users/zhouweiming/data/project/iermu_opssite/src/node_modules/.typescript@2.2.0-dev.20161206/lib/typescript.js:46544:28)
at serializeParameterTypesOfNode (/Users/zhouweiming/data/project/iermu_opssite/src/node_modules/.typescript@2.2.0-dev.20161206/lib/typescript.js:46596:42)
at addOldTypeMetadata (/Users/zhouweiming/data/project/iermu_opssite/src/node_modules/.typescript@2.2.0-dev.20161206/lib/typescript.js:46471:98)
at addTypeMetadata (/Users/zhouweiming/data/project/iermu_opssite/src/node_modules/.typescript@2.2.0-dev.20161206/lib/typescript.js:46462:17)
at transformAllDecoratorsOfDeclaration (/Users/zhouweiming/data/project/iermu_opssite/src/node_modules/.typescript@2.2.0-dev.20161206/lib/typescript.js:46301:13)
at generateConstructorDecorationExpression (/Users/zhouweiming/data/project/iermu_opssite/src/node_modules/.typescript@2.2.0-dev.20161206/lib/typescript.js:46411:40)
at addConstructorDecorationStatement (/Users/zhouweiming/data/project/iermu_opssite/src/node_modules/.typescript@2.2.0-dev.20161206/lib/typescript.js:46399:30)
at visitClassDeclaration (/Users/zhouweiming/data/project/iermu_opssite/src/node_modules/.typescript@2.2.0-dev.20161206/lib/typescript.js:45681:13)
at visitTypeScript (/Users/zhouweiming/data/project/iermu_opssite/src/node_modules/.typescript@2.2.0-dev.20161206/lib/typescript.js:45536:28)
at visitorWorker (/Users/zhouweiming/data/project/iermu_opssite/src/node_modules/.typescript@2.2.0-dev.20161206/lib/typescript.js:45351:24)
at sourceElementVisitorWorker (/Users/zhouweiming/data/project/iermu_opssite/src/node_modules/.typescript@2.2.0-dev.20161206/lib/typescript.js:45383:28)
at saveStateAndInvoke (/Users/zhouweiming/data/project/iermu_opssite/src/node_modules/.typescript@2.2.0-dev.20161206/lib/typescript.js:45304:27)
at sourceElementVisitor (/Users/zhouweiming/data/project/iermu_opssite/src/node_modules/.typescript@2.2.0-dev.20161206/lib/typescript.js:45365:20)
at visitNodes (/Users/zhouweiming/data/project/iermu_opssite/src/node_modules/.typescript@2.2.0-dev.20161206/lib/typescript.js:44366:48)
at Object.visitLexicalEnvironment (/Users/zhouweiming/data/project/iermu_opssite/src/node_modules/.typescript@2.2.0-dev.20161206/lib/typescript.js:44404:22)
at visitSourceFile (/Users/zhouweiming/data/project/iermu_opssite/src/node_modules/.typescript@2.2.0-dev.20161206/lib/typescript.js:45622:53)
at saveStateAndInvoke (/Users/zhouweiming/data/project/iermu_opssite/src/node_modules/.typescript@2.2.0-dev.20161206/lib/typescript.js:45304:27)
at transformSourceFile (/Users/zhouweiming/data/project/iermu_opssite/src/node_modules/.typescript@2.2.0-dev.20161206/lib/typescript.js:45288:27) |
That's very strange. I haven't seen that error in my Angular project and I've been using 2.1.1 (rc) for weeks now. I've been using the latest available tsloader, the same version of webpack and the previous patch release 2.2.3. |
That's really strange, I am preparing a simple demo to test again. that is my tsconfig.json:
|
Host your demo on GitHub and I'll take a look later. |
thanks at first, @aluanhaddad @mhegazy simple demo is here:
you will see the error. tried any of the following three ways, can be resolved this error, but I do not know why:
But before and include the version 2.0.3, these codes can compile success. |
Still investigating, so far this looks related to #11391 |
Looks like this has to do with how Angular 2 statically captures decorators into ngfactories... |
Angular 2 does not support inherited decorators. Prior to typescript@2.1.*, inherited decorators would have been ignored, by both Angular 2 and TypeScript but I suspect the change to use the return value of @zhouweiming Upgrading your project's @angular dependencies to @mhegazy This may also be related to how Angular 2 treats decorators. It considers them to be pseudo-design time constructs and they get transformed into class properties of the factories that the angular compiler generates, the consumption of decorators by Angular is a bit odd since they lose much of their capabilities but this is not obvious to users and is poorly documented in Angular. |
ugh now it stopped working again 😭 |
Yes, I also tried it at angular@2.3.0-rc.0, same error again |
Sign my error was I ran |
@aluanhaddad I found another issue. in project: https://github.com/zhouweiming/tsissuedemo
show errors:
but compile success at typescript@2.2.0-dev.20161206 |
This isn't an Angular-specific problem: I'm getting exactly the same error with a React project I'm using Typescript 2.1.4 with. Note that I'm also using MobX and mobx-react, with the decorator syntax (@observer etc.). I can post more information if it will help. |
(For historical information:) I was experiencing this on TS 2.0.3 when I was using a decorator on a constructor argument whose type was declared to be null: export class RootComponent {
public constructor (@Inject(LAUNCH_DEPENDENCIES) ld : null) {}
} In this case the injected value is actually Since we aren't able to upgrade TS at the moment, we got around it simply by changing the typing to |
This issue was resolved after I upgraded to TypeScript 2.3.4. |
TypeScript Version: 2.1.1 / nightly (2.2.0-dev.20161206)
When I compile my angular2 project with webpack and awesome-typescript-loader, get errors:
get same error on typescript@2.1.1 and typescript@2.0.10 and typescript@2.2.0-dev.20161206.
other env
:When I remove
@Injectable()
from all my codes, my project can compile success, but in browser I get errors: can't resolve all params in a class who depend another@Injectable()
class.The text was updated successfully, but these errors were encountered: