Skip to content

Use async/await in npm distribution to improve stack traces #671

Closed
@Yogu

Description

@Yogu

Currently, the files in the distributed npm package use tslib_1.__awaiter and generator functions instead of async / await. Since node version 7.6.0, native async/await is supported. Besides readability, native async/await has the advantage that stack traces contain the asynchronous context. This is very useful when debugging request errors.

The oldest supported version of node is v12, so I'd suggest to use a tsconfig.json that makes use of all the node-v12 features:

{
  "compilerOptions": {
    "lib": ["es2019", "es2020.bigint", "es2020.string", "es2020.symbol.wellknown"],
    "module": "commonjs",
    "target": "es2019"
  }
}

Otherwise, targeting ES2017 would be enough to emit native async/await.

(Sorry for removing the issue template; since I'm not reporting a bug and it has nothing to do with kubernetes itself, it didn't seem to fit.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions