TypeScript: 5.0.0-dev.20230103
- π’: both compile and runtime are working correctly
- π‘: for compile, it means there is an error, but can be suppressed (e.g. with
skipLibCheck
)
for runtime, it means the compile fails, but runtime is working - π΄: compile and/or runtime fails
- β: compile success, but runtime fails. Potentially a TypeScript bug.
- β: invalid usage in this test configuration
Import Syntax:
default as
:import { default as m } from 'm'
default
:import m from 'm'
* as
:import * as m from 'm'
named
:import { something } from 'm'
module | Package | Type | import: default as | import: default | import: * as | import: { named } |
---|---|---|---|---|---|---|
commonjs | assert | π» compile | π΄ TS1259-e | π΄ TS1259-e | π’ | β |
π runtime | π΄ type-not-fn | π΄ type-not-fn | π’ | β | ||
assertron | π» compile | π‘ TS1259-e-t | π‘ TS1259-e-t | π‘ TS1259-e-t | β | |
π runtime | π‘ | π‘ | π‘ | β | ||
cjs | π» compile | π’ | π’ | π’ | β | |
π runtime | π’ | π’ | π’ | β | ||
es-cjs | π» compile | π’ | π’ | π’ | β | |
π runtime | π’ | π’ | π’ | β | ||
esm | π» compile | β | β | β | β | |
π runtime | β | β | β | β | ||
esm-cjs | π» compile | π’ | π’ | π’ | β | |
π runtime | β Error | β Error-1 | β Error-2 | β | ||
named-cjs | π» compile | β | β | π’ | π’ | |
π runtime | β | β | π’ | π’ | ||
named-es-cjs | π» compile | β | β | π’ | π’ | |
π runtime | β | β | π’ | π’ | ||
named-esm | π» compile | β | β | β | β | |
π runtime | β | β | β | β | ||
named-esm-cjs | π» compile | β | β | π’ | π’ | |
π runtime | β | β | π’ | π’ | ||
param-case | π» compile | π΄ TS1259-e-1 | π΄ TS1259-e-1 | π΄ TS2497-e | β | |
π runtime | π΄ type-not-fn-1 | π΄ type-not-fn-1 | π‘ | β | ||
es2015 | assert | π» compile | π΄ TS1259-a | π΄ TS1259-a | π’ | β |
π runtime | π΄ syntax | π΄ syntax | β syntax | β | ||
assertron | π» compile | π‘ TS1259-a-t | π‘ TS1259-a-t | π‘ TS1259-a-t | β | |
π runtime | π΄ syntax | π΄ syntax | π΄ syntax | β | ||
cjs | π» compile | π’ | π’ | π’ | β | |
π runtime | β syntax | β syntax | β syntax | β | ||
es-cjs | π» compile | π’ | π’ | π’ | β | |
π runtime | β syntax | β syntax | β syntax | β | ||
esm | π» compile | β | β | β | β | |
π runtime | β | β | β | β | ||
esm-cjs | π» compile | π’ | π’ | π’ | β | |
π runtime | β syntax | β syntax | β syntax | β | ||
named-cjs | π» compile | β | β | π’ | π’ | |
π runtime | β | β | β syntax | β syntax | ||
named-es-cjs | π» compile | β | β | π’ | π’ | |
π runtime | β | β | β syntax | β syntax | ||
named-esm | π» compile | β | β | β | β | |
π runtime | β | β | β | β | ||
named-esm-cjs | π» compile | β | β | π’ | π’ | |
π runtime | β | β | β syntax | β syntax | ||
param-case | π» compile | π΄ TS1259-a-1 | π΄ TS1259-a-1 | π΄ TS2497-a | β | |
π runtime | π΄ syntax | π΄ syntax | π΄ syntax | β | ||
es2020 | assert | π» compile | π΄ TS1259-a | π΄ TS1259-a | π’ | β |
π runtime | π΄ syntax | π΄ syntax | β syntax | β | ||
assertron | π» compile | π‘ TS1259-a-t | π‘ TS1259-a-t | π‘ TS1259-a-t | β | |
π runtime | π΄ syntax | π΄ syntax | π΄ syntax | β | ||
cjs | π» compile | π’ | π’ | π’ | β | |
π runtime | β syntax | β syntax | β syntax | β | ||
es-cjs | π» compile | π’ | π’ | π’ | β | |
π runtime | β syntax | β syntax | β syntax | β | ||
esm | π» compile | β | β | β | β | |
π runtime | β | β | β | β | ||
esm-cjs | π» compile | π’ | π’ | π’ | β | |
π runtime | β syntax | β syntax | β syntax | β | ||
named-cjs | π» compile | β | β | π’ | π’ | |
π runtime | β | β | β syntax | β syntax | ||
named-es-cjs | π» compile | β | β | π’ | π’ | |
π runtime | β | β | β syntax | β syntax | ||
named-esm | π» compile | β | β | β | β | |
π runtime | β | β | β | β | ||
named-esm-cjs | π» compile | β | β | π’ | π’ | |
π runtime | β | β | β syntax | β syntax | ||
param-case | π» compile | π΄ TS1259-a-1 | π΄ TS1259-a-1 | π΄ TS2497-a | β | |
π runtime | π΄ syntax | π΄ syntax | π΄ syntax | β | ||
es2022 | assert | π» compile | π΄ TS1259-a | π΄ TS1259-a | π’ | β |
π runtime | π΄ syntax | π΄ syntax | β syntax | β | ||
assertron | π» compile | π‘ TS1259-a-t | π‘ TS1259-a-t | π‘ TS1259-a-t | β | |
π runtime | π΄ syntax | π΄ syntax | π΄ syntax | β | ||
cjs | π» compile | π’ | π’ | π’ | β | |
π runtime | β syntax | β syntax | β syntax | β | ||
es-cjs | π» compile | π’ | π’ | π’ | β | |
π runtime | β syntax | β syntax | β syntax | β | ||
esm | π» compile | β | β | β | β | |
π runtime | β | β | β | β | ||
esm-cjs | π» compile | π’ | π’ | π’ | β | |
π runtime | β syntax | β syntax | β syntax | β | ||
named-cjs | π» compile | β | β | π’ | π’ | |
π runtime | β | β | β syntax | β syntax | ||
named-es-cjs | π» compile | β | β | π’ | π’ | |
π runtime | β | β | β syntax | β syntax | ||
named-esm | π» compile | β | β | β | β | |
π runtime | β | β | β | β | ||
named-esm-cjs | π» compile | β | β | π’ | π’ | |
π runtime | β | β | β syntax | β syntax | ||
param-case | π» compile | π΄ TS1259-a-1 | π΄ TS1259-a-1 | π΄ TS2497-a | β | |
π runtime | π΄ syntax | π΄ syntax | π΄ syntax | β | ||
esnext | assert | π» compile | π΄ TS1259-a | π΄ TS1259-a | π’ | β |
π runtime | π΄ syntax | π΄ syntax | β syntax | β | ||
assertron | π» compile | π‘ TS1259-a-t | π‘ TS1259-a-t | π‘ TS1259-a-t | β | |
π runtime | π΄ syntax | π΄ syntax | π΄ syntax | β | ||
cjs | π» compile | π’ | π’ | π’ | β | |
π runtime | β syntax | β syntax | β syntax | β | ||
es-cjs | π» compile | π’ | π’ | π’ | β | |
π runtime | β syntax | β syntax | β syntax | β | ||
esm | π» compile | β | β | β | β | |
π runtime | β | β | β | β | ||
esm-cjs | π» compile | π’ | π’ | π’ | β | |
π runtime | β syntax | β syntax | β syntax | β | ||
named-cjs | π» compile | β | β | π’ | π’ | |
π runtime | β | β | β syntax | β syntax | ||
named-es-cjs | π» compile | β | β | π’ | π’ | |
π runtime | β | β | β syntax | β syntax | ||
named-esm | π» compile | β | β | β | β | |
π runtime | β | β | β | β | ||
named-esm-cjs | π» compile | β | β | π’ | π’ | |
π runtime | β | β | β syntax | β syntax | ||
param-case | π» compile | π΄ TS1259-a-1 | π΄ TS1259-a-1 | π΄ TS2497-a | β | |
π runtime | π΄ syntax | π΄ syntax | π΄ syntax | β | ||
node16 | assert | π» compile | π΄ TS1259-a | π΄ TS1259-a | π’ | β |
π runtime | π΄ type-not-fn | π΄ type-not-fn | π’ | β | ||
assertron | π» compile | π‘ TS1259-a-t | π‘ TS1259-a-t | π‘ TS1259-a-t | β | |
π runtime | π‘ | π‘ | π‘ | β | ||
cjs | π» compile | π’ | π’ | π’ | β | |
π runtime | π’ | π’ | π’ | β | ||
es-cjs | π» compile | π’ | π’ | π’ | β | |
π runtime | π’ | π’ | π’ | β | ||
esm | π» compile | β | β | β | β | |
π runtime | β | β | β | β | ||
esm-cjs | π» compile | π’ | π’ | π’ | β | |
π runtime | β Error-3 | β Error-4 | β Error-5 | β | ||
named-cjs | π» compile | β | β | π’ | π’ | |
π runtime | β | β | π’ | π’ | ||
named-es-cjs | π» compile | β | β | π’ | π’ | |
π runtime | β | β | π’ | π’ | ||
named-esm | π» compile | β | β | β | β | |
π runtime | β | β | β | β | ||
named-esm-cjs | π» compile | β | β | π’ | π’ | |
π runtime | β | β | π’ | π’ | ||
param-case | π» compile | π΄ TS1259-a-1 | π΄ TS1259-a-1 | π΄ TS2497-a | β | |
π runtime | π΄ type-not-fn-1 | π΄ type-not-fn-1 | π‘ | β | ||
nodenext | assert | π» compile | π΄ TS1259-a | π΄ TS1259-a | π’ | β |
π runtime | π΄ type-not-fn | π΄ type-not-fn | π’ | β | ||
assertron | π» compile | π‘ TS1259-a-t | π‘ TS1259-a-t | π‘ TS1259-a-t | β | |
π runtime | π‘ | π‘ | π‘ | β | ||
cjs | π» compile | π’ | π’ | π’ | β | |
π runtime | π’ | π’ | π’ | β | ||
es-cjs | π» compile | π’ | π’ | π’ | β | |
π runtime | π’ | π’ | π’ | β | ||
esm | π» compile | β | β | β | β | |
π runtime | β | β | β | β | ||
esm-cjs | π» compile | π’ | π’ | π’ | β | |
π runtime | β Error-6 | β Error-7 | β Error-8 | β | ||
named-cjs | π» compile | β | β | π’ | π’ | |
π runtime | β | β | π’ | π’ | ||
named-es-cjs | π» compile | β | β | π’ | π’ | |
π runtime | β | β | π’ | π’ | ||
named-esm | π» compile | β | β | β | β | |
π runtime | β | β | β | β | ||
named-esm-cjs | π» compile | β | β | π’ | π’ | |
π runtime | β | β | π’ | π’ | ||
param-case | π» compile | π΄ TS1259-a-1 | π΄ TS1259-a-1 | π΄ TS2497-a | β | |
π runtime | π΄ type-not-fn-1 | π΄ type-not-fn-1 | π‘ | β |
TS1259-a
:Module '"assert"' can only be default-imported using the 'allowSyntheticDefaultImports' flag
TS1259-a-1
:Module '"/home/homa/code/cyberuni/ts-esm-interop/node_modules/.pnpm/param-case@1.1.2/node_modules/param-case/param-case"' can only be default-imported using the 'allowSyntheticDefaultImports' flag
TS1259-a-t
:Module '"/home/homa/code/cyberuni/ts-esm-interop/node_modules/.pnpm/assertion-error@1.1.0/node_modules/assertion-error/index"' can only be default-imported using the 'allowSyntheticDefaultImports' flag
TS1259-e
:Module '"assert"' can only be default-imported using the 'esModuleInterop' flag
TS1259-e-1
:Module '"/home/homa/code/cyberuni/ts-esm-interop/node_modules/.pnpm/param-case@1.1.2/node_modules/param-case/param-case"' can only be default-imported using the 'esModuleInterop' flag
TS1259-e-t
:Module '"/home/homa/code/cyberuni/ts-esm-interop/node_modules/.pnpm/assertion-error@1.1.0/node_modules/assertion-error/index"' can only be default-imported using the 'esModuleInterop' flag
TS2497-a
:This module can only be referenced with ECMAScript imports/exports by turning on the 'allowSyntheticDefaultImports' flag and referencing its default export.
TS2497-e
:This module can only be referenced with ECMAScript imports/exports by turning on the 'esModuleInterop' flag and referencing its default export.
Error
: `Command failed: node esm-cjs.default-as.all.js node:internal/modules/cjs/loader:535 throw e; ^
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in /home/homa/code/cyberuni/ts-esm-interop/tests/node/node_modules/esm-cjs/package.json at new NodeError (node:internal/errors:393:5) at throwExportsNotFound (node:internal/modules/esm/resolve:358:9) at packageExportsResolve (node:internal/modules/esm/resolve:612:7) at resolveExports (node:internal/modules/cjs/loader:529:36) at Module._findPath (node:internal/modules/cjs/loader:569:31) at Module._resolveFilename (node:internal/modules/cjs/loader:981:27) at Module._load (node:internal/modules/cjs/loader:841:27) at Module.require (node:internal/modules/cjs/loader:1061:19) at require (node:internal/modules/cjs/helpers:103:18) at Object. (/home/homa/code/cyberuni/ts-esm-interop/tests/node/commonjs/esm-cjs.default-as.all.js:3:19) { code: 'ERR_PACKAGE_PATH_NOT_EXPORTED' }
Node.js v18.12.1 `
Error-1
: `Command failed: node esm-cjs.default.all.js node:internal/modules/cjs/loader:535 throw e; ^
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in /home/homa/code/cyberuni/ts-esm-interop/tests/node/node_modules/esm-cjs/package.json at new NodeError (node:internal/errors:393:5) at throwExportsNotFound (node:internal/modules/esm/resolve:358:9) at packageExportsResolve (node:internal/modules/esm/resolve:612:7) at resolveExports (node:internal/modules/cjs/loader:529:36) at Module._findPath (node:internal/modules/cjs/loader:569:31) at Module._resolveFilename (node:internal/modules/cjs/loader:981:27) at Module._load (node:internal/modules/cjs/loader:841:27) at Module.require (node:internal/modules/cjs/loader:1061:19) at require (node:internal/modules/cjs/helpers:103:18) at Object. (/home/homa/code/cyberuni/ts-esm-interop/tests/node/commonjs/esm-cjs.default.all.js:3:19) { code: 'ERR_PACKAGE_PATH_NOT_EXPORTED' }
Node.js v18.12.1 `
Error-2
: `Command failed: node esm-cjs.star.all.js node:internal/modules/cjs/loader:535 throw e; ^
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in /home/homa/code/cyberuni/ts-esm-interop/tests/node/node_modules/esm-cjs/package.json at new NodeError (node:internal/errors:393:5) at throwExportsNotFound (node:internal/modules/esm/resolve:358:9) at packageExportsResolve (node:internal/modules/esm/resolve:612:7) at resolveExports (node:internal/modules/cjs/loader:529:36) at Module._findPath (node:internal/modules/cjs/loader:569:31) at Module._resolveFilename (node:internal/modules/cjs/loader:981:27) at Module._load (node:internal/modules/cjs/loader:841:27) at Module.require (node:internal/modules/cjs/loader:1061:19) at require (node:internal/modules/cjs/helpers:103:18) at Object. (/home/homa/code/cyberuni/ts-esm-interop/tests/node/commonjs/esm-cjs.star.all.js:3:11) { code: 'ERR_PACKAGE_PATH_NOT_EXPORTED' }
Node.js v18.12.1 `
Error-3
: `Command failed: node esm-cjs.default-as.all.js node:internal/modules/cjs/loader:535 throw e; ^
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in /home/homa/code/cyberuni/ts-esm-interop/tests/node/node_modules/esm-cjs/package.json at new NodeError (node:internal/errors:393:5) at throwExportsNotFound (node:internal/modules/esm/resolve:358:9) at packageExportsResolve (node:internal/modules/esm/resolve:612:7) at resolveExports (node:internal/modules/cjs/loader:529:36) at Module._findPath (node:internal/modules/cjs/loader:569:31) at Module._resolveFilename (node:internal/modules/cjs/loader:981:27) at Module._load (node:internal/modules/cjs/loader:841:27) at Module.require (node:internal/modules/cjs/loader:1061:19) at require (node:internal/modules/cjs/helpers:103:18) at Object. (/home/homa/code/cyberuni/ts-esm-interop/tests/node/node16/esm-cjs.default-as.all.js:3:19) { code: 'ERR_PACKAGE_PATH_NOT_EXPORTED' }
Node.js v18.12.1 `
Error-4
: `Command failed: node esm-cjs.default.all.js node:internal/modules/cjs/loader:535 throw e; ^
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in /home/homa/code/cyberuni/ts-esm-interop/tests/node/node_modules/esm-cjs/package.json at new NodeError (node:internal/errors:393:5) at throwExportsNotFound (node:internal/modules/esm/resolve:358:9) at packageExportsResolve (node:internal/modules/esm/resolve:612:7) at resolveExports (node:internal/modules/cjs/loader:529:36) at Module._findPath (node:internal/modules/cjs/loader:569:31) at Module._resolveFilename (node:internal/modules/cjs/loader:981:27) at Module._load (node:internal/modules/cjs/loader:841:27) at Module.require (node:internal/modules/cjs/loader:1061:19) at require (node:internal/modules/cjs/helpers:103:18) at Object. (/home/homa/code/cyberuni/ts-esm-interop/tests/node/node16/esm-cjs.default.all.js:3:19) { code: 'ERR_PACKAGE_PATH_NOT_EXPORTED' }
Node.js v18.12.1 `
Error-5
: `Command failed: node esm-cjs.star.all.js node:internal/modules/cjs/loader:535 throw e; ^
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in /home/homa/code/cyberuni/ts-esm-interop/tests/node/node_modules/esm-cjs/package.json at new NodeError (node:internal/errors:393:5) at throwExportsNotFound (node:internal/modules/esm/resolve:358:9) at packageExportsResolve (node:internal/modules/esm/resolve:612:7) at resolveExports (node:internal/modules/cjs/loader:529:36) at Module._findPath (node:internal/modules/cjs/loader:569:31) at Module._resolveFilename (node:internal/modules/cjs/loader:981:27) at Module._load (node:internal/modules/cjs/loader:841:27) at Module.require (node:internal/modules/cjs/loader:1061:19) at require (node:internal/modules/cjs/helpers:103:18) at Object. (/home/homa/code/cyberuni/ts-esm-interop/tests/node/node16/esm-cjs.star.all.js:3:11) { code: 'ERR_PACKAGE_PATH_NOT_EXPORTED' }
Node.js v18.12.1 `
Error-6
: `Command failed: node esm-cjs.default-as.all.js node:internal/modules/cjs/loader:535 throw e; ^
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in /home/homa/code/cyberuni/ts-esm-interop/tests/node/node_modules/esm-cjs/package.json at new NodeError (node:internal/errors:393:5) at throwExportsNotFound (node:internal/modules/esm/resolve:358:9) at packageExportsResolve (node:internal/modules/esm/resolve:612:7) at resolveExports (node:internal/modules/cjs/loader:529:36) at Module._findPath (node:internal/modules/cjs/loader:569:31) at Module._resolveFilename (node:internal/modules/cjs/loader:981:27) at Module._load (node:internal/modules/cjs/loader:841:27) at Module.require (node:internal/modules/cjs/loader:1061:19) at require (node:internal/modules/cjs/helpers:103:18) at Object. (/home/homa/code/cyberuni/ts-esm-interop/tests/node/nodenext/esm-cjs.default-as.all.js:3:19) { code: 'ERR_PACKAGE_PATH_NOT_EXPORTED' }
Node.js v18.12.1 `
Error-7
: `Command failed: node esm-cjs.default.all.js node:internal/modules/cjs/loader:535 throw e; ^
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in /home/homa/code/cyberuni/ts-esm-interop/tests/node/node_modules/esm-cjs/package.json at new NodeError (node:internal/errors:393:5) at throwExportsNotFound (node:internal/modules/esm/resolve:358:9) at packageExportsResolve (node:internal/modules/esm/resolve:612:7) at resolveExports (node:internal/modules/cjs/loader:529:36) at Module._findPath (node:internal/modules/cjs/loader:569:31) at Module._resolveFilename (node:internal/modules/cjs/loader:981:27) at Module._load (node:internal/modules/cjs/loader:841:27) at Module.require (node:internal/modules/cjs/loader:1061:19) at require (node:internal/modules/cjs/helpers:103:18) at Object. (/home/homa/code/cyberuni/ts-esm-interop/tests/node/nodenext/esm-cjs.default.all.js:3:19) { code: 'ERR_PACKAGE_PATH_NOT_EXPORTED' }
Node.js v18.12.1 `
Error-8
: `Command failed: node esm-cjs.star.all.js node:internal/modules/cjs/loader:535 throw e; ^
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in /home/homa/code/cyberuni/ts-esm-interop/tests/node/node_modules/esm-cjs/package.json at new NodeError (node:internal/errors:393:5) at throwExportsNotFound (node:internal/modules/esm/resolve:358:9) at packageExportsResolve (node:internal/modules/esm/resolve:612:7) at resolveExports (node:internal/modules/cjs/loader:529:36) at Module._findPath (node:internal/modules/cjs/loader:569:31) at Module._resolveFilename (node:internal/modules/cjs/loader:981:27) at Module._load (node:internal/modules/cjs/loader:841:27) at Module.require (node:internal/modules/cjs/loader:1061:19) at require (node:internal/modules/cjs/helpers:103:18) at Object. (/home/homa/code/cyberuni/ts-esm-interop/tests/node/nodenext/esm-cjs.star.all.js:3:11) { code: 'ERR_PACKAGE_PATH_NOT_EXPORTED' }
Node.js v18.12.1 `
syntax
:Cannot use import statement outside a module
type-not-fn
:(0 , assert_1.default) is not a function
type-not-fn-1
:(0 , param_case_1.default) is not a function
Depends on the test configuration, the way to consume a module are different.
In this section we describe each module and how they are consumed within this configuration.
import { default as assert } from 'assert'
assert(true)
import assert from 'assert'
assert(true)
import * as assert from 'assert'
assert(true)
import { default as assertron } from 'assertron'
assertron.truthy(true)
import assertron from 'assertron'
assertron.truthy(true)
import * as assertron from 'assertron'
assertron.default.truthy(true)
import { default as m } from 'cjs'
m()
import m from 'cjs'
m()
import * as m from 'cjs'
m.default()
import { default as m } from 'es-cjs'
m()
import m from 'es-cjs'
m()
import * as m from 'es-cjs'
m.default()
import { default as m } from 'esm-cjs'
m()
import m from 'esm-cjs'
m()
import * as m from 'esm-cjs'
m.default()
import { greet } from 'named-cjs'
greet()
import * as m from 'named-cjs'
m.greet()
import { greet } from 'named-es-cjs'
greet()
import * as m from 'named-es-cjs'
m.greet()
import { greet } from 'named-esm-cjs'
greet()
import * as m from 'named-esm-cjs'
m.greet()
import { default as paramCase } from 'param-case'
paramCase('hello world')
import paramCase from 'param-case'
paramCase('hello world')
import * as paramCase from 'param-case'
paramCase('hello world')