You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TypeScript has no .mjs .cjs support out of the box i have a patched version of it but it is a blocking issue since 5+ years and will not get solved soon
to be compatible with ECMAScript modules we need to release a diffrent version of @vertx/* we need to release a CJS and a ESM version both with the same .d.ts files and the extension needs to be .js even for the ECMAScript version. So that there is intelliSense support inside the IDE.
also files like mod.mjs need to be converted to Module style so no extension defined else it will not find the .d.ts files
the current version of @vertx/* only works with require when the module specifier is used and with .mjs we get no types.
Update
We should offer the following formart
Method 1
SubFolder esm needs to contain package,json which references the type and types
// @vertx/**/esm/*.js,*.d.ts // The d.ts should import and reexport @vertx/**/*.d.ts
// Allows import like
import '@vertx/core/esm'
require('@vertx/core/cjs'
Method 2
// @vertx/**/*.mjs.d.ts // The d.ts should import and reexport @vertx/**/*.d.ts// Allows import likeimport'@vertx/core/index.mjs'require('@vertx/core')
Method 3 most best at present!
Combine 1 and 2
till typescript adopts .mjs .cjs support
at present it is not possible to use vertx inside the ESM context with correct types inside the IDE
Reproduce
import{FileSystem}from'@vertx/core'// Will throw as it loads the CJS version.// import { FileSystem } from '@vertx/core/index.mjs' would not throw but would have no types added we would need to add index.mjs.d.ts which needs to reexport the content of index.d.ts
TypeScript has no .mjs .cjs support out of the box i have a patched version of it but it is a blocking issue since 5+ years and will not get solved soon
to be compatible with ECMAScript modules we need to release a diffrent version of @vertx/* we need to release a CJS and a ESM version both with the same .d.ts files and the extension needs to be .js even for the ECMAScript version. So that there is intelliSense support inside the IDE.
also files like mod.mjs need to be converted to Module style so no extension defined else it will not find the .d.ts files
the current version of @vertx/* only works with require when the module specifier is used and with .mjs we get no types.
Update
We should offer the following formart
Method 1
SubFolder esm needs to contain package,json which references the type and types
Method 2
Method 3 most best at present!
Combine 1 and 2
till typescript adopts .mjs .cjs support
at present it is not possible to use vertx inside the ESM context with correct types inside the IDE
Reproduce
The text was updated successfully, but these errors were encountered: