microsoft / tslib

Runtime library for TypeScript helpers.
BSD Zero Clause License
1.25k stars 126 forks source link

tslib triggers a process experimental warning in node.js 10.1.0 #50

Closed mdouglass closed 6 years ago

mdouglass commented 6 years ago

node.js 10.1.0 has moved the experimental version of the fs promises api to require('fs').promises

When tslib imports the fs module it loops over every exported variable which now triggers a process-wide warning which is logged to the console.

(node:78361) ExperimentalWarning: The fs.promises API is experimental

The stack when this happens is:

ExperimentalWarning: The fs.promises API is experimental
    at Object.get [as promises] (fs.js:84:15)
    at Object.__importStar (/Users/mdouglass/kixeye/km/server/km-sim/node_modules/tslib/tslib.js:213:100)
    at Object.<anonymous> (/Users/mdouglass/kixeye/km/server/km-sim/node_modules/@kixeye/km-shared/lib/protocols/index.ts:1:1)
    at Module._compile (internal/modules/cjs/loader.js:678:30)
    at Module._extensions..js (internal/modules/cjs/loader.js:689:10)
    at Object.require.extensions.(anonymous function) [as .js] (/Users/mdouglass/kixeye/km/server/km-sim/node_modules/ts-node/src/index.ts:395:14)
    at Module.load (internal/modules/cjs/loader.js:589:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:528:12)
    at Function.Module._load (internal/modules/cjs/loader.js:520:3)
    at Module.require (internal/modules/cjs/loader.js:626:17)
RyanCavanaugh commented 6 years ago

This seems like a node issue, not a tslib issue. Babel does the same thing for import *.

mdouglass commented 6 years ago

Looks like it is fixed already by https://github.com/nodejs/node/pull/20632