Questions about this release? Ask in the official discussion thread: #1767
Added
- Added support for
module=NodeNext
,module=Node16
,.mts
,.cts
,.mjs
, and.cjs
file extensions (#1414, #1694, #1744, #1745, #1727, #1717, #1753, #1757) @cspotcode- For best results, enable
experimentalResolver
(docs) - See TypeScript's official documentation: https://www.typescriptlang.org/docs/handbook/esm-node.html
- enables mixed-mode projects with both ESM and CommonJS
- enables all supported file extensions in TypeScript 4.7
- Obeys package.json "type"
- For best results, enable
- Added ability to include file extensions in CommonJS imports (#1727, #1753) @cspotcode
- Enables consistency with ESM, where file extensions are often mandatory
- Resolves from emitted to source file extensions (#1727, #1753) @cspotcode
- Must enable
experimentalResolver
, will be enabled by default in a future version (docs) - Typechecker requires importing the emitted file extension; ts-node resolves correctly to the source file. E.g.
import "./foo.js"
will executefoo.ts
See also: TypeScript issue #37582 - If typechecking is disabled, you can also use source file extensions. E.g.
import "./foo.ts"
- Must enable
- Added
experimentalSpecifierResolution
(#1727, #1753) @cspotcode- the same as Node's
--experimental-specifier-resolution
(Node docs) - can also be specified in
tsconfig.json
for convenience, to avoid the CLI flag - allows omitting file extensions in ESM imports, plus a few other CommonJS-style conveniences
- the same as Node's
- Adds
diagnostics
property toTSError
, with array of TypeScript diagnostic objects from the compiler (API docs) (#1705, #1706) @paulbrimicombe
Changed
- Renames option
experimentalResolverFeatures
toexperimentalResolver
(docs) (#1727) @cspotcode - Internal change to ESM loader for compatibility with forthcoming node versions: returns
shortCircuit: true
(#1714, #1715) @cspotcode - Performance: Optimize filesystem stat calls in ESM loader and new CommonJS resolver (#1758, #1759) @cspotcode
- Performance, maintenance: Upgrade source-mapper dependency "@cspotcode/source-map-support"
- Switches to "trace-mapping" for underlying source-map parsing (#1729) @cspotcode
Fixed
- Fixed bug where REPL
.type
command was not showing any type information when using TypeScript nightly builds (#1761, #1762) @cspotcode - Correctly suppress "Custom ESM Loaders" warning on newer node versions where the warning's prose changed (#1701) @cspotcode
- Fixed REPL bug where function signatures could not be entered across multiple lines (#1667, #1677) @d9k
- REPL treats unparenthesized object literals as objects, instead of as block scopes (#1697, #1699) @jhmaster2000
- Fixed bug where
preferTsExts
combined with third-party transpiler hooks could disruptnyc
code coverage (#1755) @cspotcode - Fixed bug where
file://
URLs in stack traces did not always use percent-encoding (#1738, #1726, #1729) @cspotcode - Fixed bug where v8-compile-cache-lib did not correctly unhook itself (#1717, #1718, #1719) @cspotcode
- This internal dependency is used to speed up loading the TypeScript compiler
Docs
- Many docs improvements (#1682) @cspotcode
- Options page: each option its own linkable header w/usage example (#1606) @cspotcode
- Categorize APIs in typedoc, make entrypoints more prominent (#1456) @cspotcode
- Clarify that the shorthand for
--project
is-P
, not-p
(#1731, #1734) @lobsterkatie - Add common ESM errors to Troubleshooting page (#1607) @cspotcode
v10.7.0...v10.8.0
https://github.com/TypeStrong/ts-node/milestone/12