Skip to content

Broken Source Maps #30364

@hediet

Description

@hediet

TypeScript Version: 3.4.0-dev.20190311

Search Terms: Sourcemap

Code

function test(f: Function): { a: string } {
    f();
    return { a: "test" };
}

const { a: b } = test(() => {
    console.log("foo1");
    console.log("foo2");
});

const data = test(() => {
    console.log("foo3");
    console.log("foo4");
});

tsconfig.json

{
  "compilerOptions": {
    /* Basic Options */
    "target": "es5",                          /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
    "module": "commonjs",                     /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */

    "strict": true,                           /* Enable all strict type-checking options. */

    "esModuleInterop": true,
    "sourceMap": true,
    "outDir": "out",
  },
  "include": ["index.ts"]
}

Expected behavior:
Both arrow functions are mapped properly.

Actual behavior:
Only the second arrow function is mapped properly.

Playground Link:
Source-Map-Visualization

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFix AvailableA PR has been opened for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions