TypeScript: 4.9.4
- π’: 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 | π’ | π’ | π’ | β |
π runtime | π’ | π’ | π’ | β | ||
assertron | π» compile | π’ | π’ | π’ | β | |
π runtime | π’ | π’ | π’ | β | ||
cjs | π» compile | π’ | π’ | π’ | β | |
π runtime | π’ | π’ | π’ | β | ||
color-map | π» compile | β | β | β | β | |
π runtime | β | β | β | β | ||
es-cjs | π» compile | π’ | π’ | π’ | β | |
π runtime | π’ | π’ | π’ | β | ||
esm | π» compile | β | β | β | β | |
π runtime | β | β | β | β | ||
esm-cjs | π» compile | π’ | π’ | π’ | β | |
π runtime | π’ | π’ | π’ | β | ||
named-cjs | π» compile | π’ | π’ | π’ | π’ | |
π runtime | β type | β type | π’ | π’ | ||
named-es-cjs | π» compile | π’ | π’ | π’ | π’ | |
π runtime | β type | β type | π’ | π’ | ||
named-esm | π» compile | β | β | β | β | |
π runtime | β | β | β | β | ||
named-esm-cjs | π» compile | π’ | π’ | π’ | π’ | |
π runtime | β type | β type | π’ | π’ | ||
param-case | π» compile | π’ | π’ | π΄ TS2497-e | β | |
π runtime | π’ | π’ | π΄ type-not-fn | β | ||
es2015 | assert | π» compile | π’ | π’ | π’ | β |
π runtime | π’ | π’ | π’ | β | ||
assertron | π» compile | π’ | π’ | π’ | β | |
π runtime | β type-not-fn-1 | β type-not-fn-1 | β type-not-fn-2 | β | ||
cjs | π» compile | π’ | π’ | π’ | β | |
π runtime | β type-not-fn-3 | β type-not-fn-3 | β type-not-fn-4 | β | ||
color-map | π» compile | β | β | β | β | |
π runtime | β | β | β | β | ||
es-cjs | π» compile | π’ | π’ | π’ | β | |
π runtime | β type-not-fn-3 | β type-not-fn-3 | β type-not-fn-4 | β | ||
esm | π» compile | β | β | β | β | |
π runtime | β | β | β | β | ||
esm-cjs | π» compile | π’ | π’ | π’ | β | |
π runtime | π’ | π’ | π’ | β | ||
named-cjs | π» compile | π’ | π’ | π’ | π’ | |
π runtime | π’ | π’ | π’ | π’ | ||
named-es-cjs | π» compile | π’ | π’ | π’ | π’ | |
π runtime | π’ | π’ | π’ | π’ | ||
named-esm | π» compile | β | β | β | β | |
π runtime | β | β | β | β | ||
named-esm-cjs | π» compile | π’ | π’ | π’ | π’ | |
π runtime | β syntax | β syntax | π’ | π’ | ||
param-case | π» compile | π’ | π’ | π΄ TS2497-a | β | |
π runtime | π’ | π’ | π΄ type-not-fn | β | ||
es2020 | assert | π» compile | π’ | π’ | π’ | β |
π runtime | π’ | π’ | π’ | β | ||
assertron | π» compile | π’ | π’ | π’ | β | |
π runtime | β type-not-fn-1 | β type-not-fn-1 | β type-not-fn-2 | β | ||
cjs | π» compile | π’ | π’ | π’ | β | |
π runtime | β type-not-fn-3 | β type-not-fn-3 | β type-not-fn-4 | β | ||
color-map | π» compile | β | β | β | β | |
π runtime | β | β | β | β | ||
es-cjs | π» compile | π’ | π’ | π’ | β | |
π runtime | β type-not-fn-3 | β type-not-fn-3 | β type-not-fn-4 | β | ||
esm | π» compile | β | β | β | β | |
π runtime | β | β | β | β | ||
esm-cjs | π» compile | π’ | π’ | π’ | β | |
π runtime | π’ | π’ | π’ | β | ||
named-cjs | π» compile | π’ | π’ | π’ | π’ | |
π runtime | π’ | π’ | π’ | π’ | ||
named-es-cjs | π» compile | π’ | π’ | π’ | π’ | |
π runtime | π’ | π’ | π’ | π’ | ||
named-esm | π» compile | β | β | β | β | |
π runtime | β | β | β | β | ||
named-esm-cjs | π» compile | π’ | π’ | π’ | π’ | |
π runtime | β syntax | β syntax | π’ | π’ | ||
param-case | π» compile | π’ | π’ | π΄ TS2497-a | β | |
π runtime | π’ | π’ | π΄ type-not-fn | β | ||
es2022 | assert | π» compile | π’ | π’ | π’ | β |
π runtime | π’ | π’ | π’ | β | ||
assertron | π» compile | π’ | π’ | π’ | β | |
π runtime | β type-not-fn-1 | β type-not-fn-1 | β type-not-fn-2 | β | ||
cjs | π» compile | π’ | π’ | π’ | β | |
π runtime | β type-not-fn-3 | β type-not-fn-3 | β type-not-fn-4 | β | ||
color-map | π» compile | β | β | β | β | |
π runtime | β | β | β | β | ||
es-cjs | π» compile | π’ | π’ | π’ | β | |
π runtime | β type-not-fn-3 | β type-not-fn-3 | β type-not-fn-4 | β | ||
esm | π» compile | β | β | β | β | |
π runtime | β | β | β | β | ||
esm-cjs | π» compile | π’ | π’ | π’ | β | |
π runtime | π’ | π’ | π’ | β | ||
named-cjs | π» compile | π’ | π’ | π’ | π’ | |
π runtime | π’ | π’ | π’ | π’ | ||
named-es-cjs | π» compile | π’ | π’ | π’ | π’ | |
π runtime | π’ | π’ | π’ | π’ | ||
named-esm | π» compile | β | β | β | β | |
π runtime | β | β | β | β | ||
named-esm-cjs | π» compile | π’ | π’ | π’ | π’ | |
π runtime | β syntax | β syntax | π’ | π’ | ||
param-case | π» compile | π’ | π’ | π΄ TS2497-a | β | |
π runtime | π’ | π’ | π΄ type-not-fn | β | ||
esnext | assert | π» compile | π’ | π’ | π’ | β |
π runtime | π’ | π’ | π’ | β | ||
assertron | π» compile | π’ | π’ | π’ | β | |
π runtime | β type-not-fn-1 | β type-not-fn-1 | β type-not-fn-2 | β | ||
cjs | π» compile | π’ | π’ | π’ | β | |
π runtime | β type-not-fn-3 | β type-not-fn-3 | β type-not-fn-4 | β | ||
color-map | π» compile | β | β | β | β | |
π runtime | β | β | β | β | ||
es-cjs | π» compile | π’ | π’ | π’ | β | |
π runtime | β type-not-fn-3 | β type-not-fn-3 | β type-not-fn-4 | β | ||
esm | π» compile | β | β | β | β | |
π runtime | β | β | β | β | ||
esm-cjs | π» compile | π’ | π’ | π’ | β | |
π runtime | π’ | π’ | π’ | β | ||
named-cjs | π» compile | π’ | π’ | π’ | π’ | |
π runtime | π’ | π’ | π’ | π’ | ||
named-es-cjs | π» compile | π’ | π’ | π’ | π’ | |
π runtime | π’ | π’ | π’ | π’ | ||
named-esm | π» compile | β | β | β | β | |
π runtime | β | β | β | β | ||
named-esm-cjs | π» compile | π’ | π’ | π’ | π’ | |
π runtime | β syntax | β syntax | π’ | π’ | ||
param-case | π» compile | π’ | π’ | π΄ TS2497-a | β | |
π runtime | π’ | π’ | π΄ type-not-fn | β | ||
node16 | assert | π» compile | π’ | π’ | π’ | β |
π runtime | β ref-not-defined | β ref-not-defined | β ref-not-defined | β | ||
assertron | π» compile | π’ | π’ | π’ | β | |
π runtime | β ref-not-defined | β ref-not-defined | β ref-not-defined | β | ||
cjs | π» compile | π’ | π’ | π’ | β | |
π runtime | β ref-not-defined | β ref-not-defined | β ref-not-defined | β | ||
color-map | π» compile | β | β | β | β | |
π runtime | β | β | β | β | ||
es-cjs | π» compile | π’ | π’ | π’ | β | |
π runtime | β ref-not-defined | β ref-not-defined | β ref-not-defined | β | ||
esm | π» compile | β | β | β | β | |
π runtime | β | β | β | β | ||
esm-cjs | π» compile | π’ | π’ | π’ | β | |
π runtime | β ref-not-defined | β ref-not-defined | β ref-not-defined | β | ||
named-cjs | π» compile | π’ | π’ | π’ | π’ | |
π runtime | β ref-not-defined | β ref-not-defined | β ref-not-defined | β ref-not-defined | ||
named-es-cjs | π» compile | π’ | π’ | π’ | π’ | |
π runtime | β ref-not-defined | β ref-not-defined | β ref-not-defined | β ref-not-defined | ||
named-esm | π» compile | β | β | β | β | |
π runtime | β | β | β | β | ||
named-esm-cjs | π» compile | π’ | π’ | π’ | π’ | |
π runtime | β ref-not-defined | β ref-not-defined | β ref-not-defined | β ref-not-defined | ||
param-case | π» compile | π’ | π’ | π΄ TS2497-a | β | |
π runtime | β ref-not-defined | β ref-not-defined | π΄ ref-not-defined | β | ||
nodenext | assert | π» compile | π’ | π’ | π’ | β |
π runtime | β ref-not-defined | β ref-not-defined | β ref-not-defined | β | ||
assertron | π» compile | π’ | π’ | π’ | β | |
π runtime | β ref-not-defined | β ref-not-defined | β ref-not-defined | β | ||
cjs | π» compile | π’ | π’ | π’ | β | |
π runtime | β ref-not-defined | β ref-not-defined | β ref-not-defined | β | ||
color-map | π» compile | β | β | β | β | |
π runtime | β | β | β | β | ||
es-cjs | π» compile | π’ | π’ | π’ | β | |
π runtime | β ref-not-defined | β ref-not-defined | β ref-not-defined | β | ||
esm | π» compile | β | β | β | β | |
π runtime | β | β | β | β | ||
esm-cjs | π» compile | π’ | π’ | π’ | β | |
π runtime | β ref-not-defined | β ref-not-defined | β ref-not-defined | β | ||
named-cjs | π» compile | π’ | π’ | π’ | π’ | |
π runtime | β ref-not-defined | β ref-not-defined | β ref-not-defined | β ref-not-defined | ||
named-es-cjs | π» compile | π’ | π’ | π’ | π’ | |
π runtime | β ref-not-defined | β ref-not-defined | β ref-not-defined | β ref-not-defined | ||
named-esm | π» compile | β | β | β | β | |
π runtime | β | β | β | β | ||
named-esm-cjs | π» compile | π’ | π’ | π’ | π’ | |
π runtime | β ref-not-defined | β ref-not-defined | β ref-not-defined | β ref-not-defined | ||
param-case | π» compile | π’ | π’ | π΄ TS2497-a | β | |
π runtime | β ref-not-defined | β ref-not-defined | π΄ ref-not-defined | β |
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.
ref-not-defined
:exports is not defined in ES module scope
syntax
:The requested module 'named-esm-cjs' does not provide an export named 'default'
type
:Cannot read properties of undefined (reading 'inc')
type-not-fn
:paramCase is not a function
type-not-fn-1
:assertron.truthy is not a function
type-not-fn-2
:assertron.default.truthy is not a function
type-not-fn-3
:m is not a function
type-not-fn-4
:m.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.default(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 { default as m } from 'named-cjs'
m.greet()
import m from 'named-cjs'
m.greet()
import { greet } from 'named-cjs'
greet()
import * as m from 'named-cjs'
m.greet()
named-es-cjs.default-as.all.ts:
import { default as m } from 'named-es-cjs'
m.greet()
import m from 'named-es-cjs'
m.greet()
import { greet } from 'named-es-cjs'
greet()
import * as m from 'named-es-cjs'
m.greet()
named-esm-cjs.default-as.all.ts:
import { default as m } from 'named-esm-cjs'
m.greet()
import m from 'named-esm-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')