Skip to content

Latest commit

Β 

History

History
506 lines (360 loc) Β· 27.9 KB

test-result.4.9.4.md

File metadata and controls

506 lines (360 loc) Β· 27.9 KB

TypeScript Module System Demo

TypeScript: 4.9.4

Legends

  • 🟒: 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'

Test Results

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

Test Subjects

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.

assert.default-as.all.ts:

import { default as assert } from 'assert'

assert(true)

assert.default.all.ts:

import assert from 'assert'

assert(true)

assert.star.all.ts:

import * as assert from 'assert'

assert.default(true)

assertron.default-as.all.ts:

import { default as assertron } from 'assertron'

assertron.truthy(true)

assertron.default.all.ts:

import assertron from 'assertron'

assertron.truthy(true)

assertron.star.all.ts:

import * as assertron from 'assertron'

assertron.default.truthy(true)

cjs.default-as.all.ts:

import { default as m } from 'cjs'

m()

cjs.default.all.ts:

import m from 'cjs'

m()

cjs.star.all.ts:

import * as m from 'cjs'

m.default()

es-cjs.default-as.all.ts:

import { default as m } from 'es-cjs'

m()

es-cjs.default.all.ts:

import m from 'es-cjs'

m()

es-cjs.star.all.ts:

import * as m from 'es-cjs'

m.default()

esm-cjs.default-as.all.ts:

import { default as m } from 'esm-cjs'

m()

esm-cjs.default.all.ts:

import m from 'esm-cjs'

m()

esm-cjs.star.all.ts:

import * as m from 'esm-cjs'

m.default()

named-cjs.default-as.all.ts:

import { default as m } from 'named-cjs'

m.greet()

named-cjs.default.all.ts:

import m from 'named-cjs'

m.greet()

named-cjs.named.all.ts:

import { greet } from 'named-cjs'

greet()

named-cjs.star.all.ts:

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()

named-es-cjs.default.all.ts:

import m from 'named-es-cjs'

m.greet()

named-es-cjs.named.all.ts:

import { greet } from 'named-es-cjs'

greet()

named-es-cjs.star.all.ts:

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()

named-esm-cjs.default.all.ts:

import m from 'named-esm-cjs'

m.greet()

named-esm-cjs.named.all.ts:

import { greet } from 'named-esm-cjs'

greet()

named-esm-cjs.star.all.ts:

import * as m from 'named-esm-cjs'

m.greet()

param-case.default-as.all.ts:

import { default as paramCase } from 'param-case'

paramCase('hello world')

param-case.default.all.ts:

import paramCase from 'param-case'

paramCase('hello world')

param-case.star.all.ts:

import * as paramCase from 'param-case'

paramCase('hello world')