class Bar
{
}
class Foo
{
_bar: Bar;
constructor()
{
this._bar = new Bar();
}
SetBar(): void
{
let bar: ?Bar = null;
if (bar != null)
{
this._bar = bar;
}
}
}
Produces the error:
C:\Users\Scott\documents\github\test\node_modules\babel-core\lib\transformation\file\index.js:540
throw err;
^
TypeError: C:/Users/Scott/documents/github/test/foo.js: Cannot read property 'name' of undefined
at maybeInstanceOfAnnotation (C:\Users\Scott\documents\github\test\node_modules\babel-plugin-typecheck\lib\index.js:2377:44)
at maybeInstanceOfAnnotation (C:\Users\Scott\documents\github\test\node_modules\babel-plugin-typecheck\lib\index.js:2375:16)
at Object._instanceof [as instanceof] (C:\Users\Scott\documents\github\test\node_modules\babel-plugin-typecheck\lib\index.js:594:16)
at staticCheckAnnotation (C:\Users\Scott\documents\github\test\node_modules\babel-plugin-typecheck\lib\index.js:1369:41)
at AssignmentExpression (C:\Users\Scott\documents\github\test\node_modules\babel-plugin-typecheck\lib\index.js:404:16)
at NodePath._call (C:\Users\Scott\documents\github\test\node_modules\babel-traverse\lib\path\context.js:74:18)
at NodePath.call (C:\Users\Scott\documents\github\test\node_modules\babel-traverse\lib\path\context.js:46:17)
at NodePath.visit (C:\Users\Scott\documents\github\test\node_modules\babel-traverse\lib\path\context.js:104:12)
at TraversalContext.visitQueue (C:\Users\Scott\documents\github\test\node_modules\babel-traverse\lib\context.js:153:16)
at TraversalContext.visitSingle (C:\Users\Scott\documents\github\test\node_modules\babel-traverse\lib\context.js:113:19)
When attempting to use the require hook or use the babel cli. Removing the _bar: Bar; removes the error.
The following example:
Produces the error:
When attempting to use the require hook or use the babel cli. Removing the
_bar: Bar;
removes the error.