Typescript: Cannot read property 'emitNode' of undefined

Created on 17 Dec 2016  路  7Comments  路  Source: microsoft/TypeScript

TS version: Version 2.2.0-dev.20161216

typescript/lib/tsc.js:49834
                throw e;
                ^
TypeError: Cannot read property 'emitNode' of undefined
    at Object.getEmitFlags (typescript/lib/tsc.js:10663:28)
    at emitPropertyAssignment (typescript/lib/tsc.js:48624:21)
    at pipelineEmitInUnspecifiedContext (typescript/lib/tsc.js:47547:28)
    at pipelineEmitForContext (typescript/lib/tsc.js:47310:32)
    at emitNodeWithSubstitution (typescript/lib/tsc.js:45012:17)
    at pipelineEmitWithSubstitution (typescript/lib/tsc.js:47304:13)
    at emitNodeWithSourceMap (typescript/lib/tsc.js:45287:21)
    at pipelineEmitWithSourceMap (typescript/lib/tsc.js:47301:13)
    at emitNodeWithComments (typescript/lib/tsc.js:45413:17)
    at pipelineEmitWithComments (typescript/lib/tsc.js:47293:13)

Watching build tasks has finished.

Got this, but unfortunately I'm not sure how to reproduce

Bug Fixed

Most helpful comment

Pinpointed the problem to an empty brackets, this is enough to make the watch task fail

      <View>
        <ListView refreshControl={
          <RefreshControl onRefresh={} refreshing={} />
        } dataSource={this.state.ds} renderRow={}>
        </ListView>
      </View>

All 7 comments

Got this error after upgrade typescript from 2.0.3 to 2.1.4 released.
macOS 10.12.1, node 6.9.1

/Users/jointsong/.config/yarn/global/node_modules/typescript/lib/tsc.js:49700
throw e;
^

TypeError: Cannot read property 'emitNode' of undefined
at Object.getEmitFlags (/Users/jointsong/.config/yarn/global/node_modules/typescript/lib/tsc.js:10680:28)
at emitPropertyAssignment (/Users/jointsong/.config/yarn/global/node_modules/typescript/lib/tsc.js:48490:21)
at pipelineEmitInUnspecifiedContext (/Users/jointsong/.config/yarn/global/node_modules/typescript/lib/tsc.js:47413:28)
at pipelineEmitForContext (/Users/jointsong/.config/yarn/global/node_modules/typescript/lib/tsc.js:47176:32)
at emitNodeWithSubstitution (/Users/jointsong/.config/yarn/global/node_modules/typescript/lib/tsc.js:44882:17)
at pipelineEmitWithSubstitution (/Users/jointsong/.config/yarn/global/node_modules/typescript/lib/tsc.js:47170:13)
at emitNodeWithSourceMap (/Users/jointsong/.config/yarn/global/node_modules/typescript/lib/tsc.js:45140:24)
at pipelineEmitWithSourceMap (/Users/jointsong/.config/yarn/global/node_modules/typescript/lib/tsc.js:47167:13)
at emitNodeWithComments (/Users/jointsong/.config/yarn/global/node_modules/typescript/lib/tsc.js:45296:25)
at pipelineEmitWithComments (/Users/jointsong/.config/yarn/global/node_modules/typescript/lib/tsc.js:47159:13)
at emitNodeWithNotification (/Users/jointsong/.config/yarn/global/node_modules/typescript/lib/tsc.js:44898:21)
at pipelineEmitWithNotification (/Users/jointsong/.config/yarn/global/node_modules/typescript/lib/tsc.js:47152:13)
at emit (/Users/jointsong/.config/yarn/global/node_modules/typescript/lib/tsc.js:47143:13)

Without steps/code snippet to reproduce this issue it is unactionable for us. We would be happy to sign any NDA required to get access to the sources triggering the issue.

I can't reproduce it from my side FYI. Restarted vscode and never got it again. Only hope in @joint-song ;)

This's my fault. There are many conflicts in my code, will cause compiling error. @wallverb @mhegazy

I've been able to reproduce the issue on a React-based project of mine with

import * as React from "react"
let x = <li key={} />

versions

webpack @ 1.13.2
tsc @ 2.1.4
ts-loader @ 0.8.2

my webpack config

var webpack = require("webpack");
var CopyWebpackPlugin = require("copy-webpack-plugin");
var path = require("path");

module.exports = {
    entry: "./src/client/client",
    output: {
        path: path.resolve("./dist/client"),
        filename: "client.bundle.js"
    },
    cache: true,
    devtool: "source-map",
    resolve: {
        extensions: ["", ".ts", ".js", ".tsx", ".jsx"]
    },
    module: {
        loaders: [
            {
                test: /\.tsx?$/,
                loader: "ts-loader"
            },
            {
                test: /\.jsx?$/,
                exclude: /node_modules/,
                loader: "babel",
                query: {
                    presets: [
                        "es2015"
                    ]
                }
            }
        ],
        preLoaders: [
            {
                test: /\.tsx?$/,
                loader: "tslint"
            },
            {
                test: /\.jsx?$/,
                loader: "source-map-loader"
            }
        ]
    },
    plugins: [
        new CopyWebpackPlugin([
            { from: "static" } // Copy contents of /static to /dist/client/
        ])
        // new webpack.optimize.UglifyJsPlugin([]),
        // new webpack.optimize.DedupePlugin()
    ]
}

get this too as well, randomly, using --watch and on a react native project. it seems to happen on .tsx files, but the stacktrace is opaque (on 2.2.0-dev.20161228)

23:25:22 - File change detected. Starting incremental compilation...
C:\nodejs\node_modules\typescript\lib\tsc.js:50224
                throw e;
                ^
TypeError: Cannot read property 'emitNode' of undefined
    at Object.getEmitFlags (C:\nodejs\node_modules\typescript\lib\tsc.js:10717:28)

Pinpointed the problem to an empty brackets, this is enough to make the watch task fail

      <View>
        <ListView refreshControl={
          <RefreshControl onRefresh={} refreshing={} />
        } dataSource={this.state.ds} renderRow={}>
        </ListView>
      </View>
Was this page helpful?
0 / 5 - 0 ratings