salomonbrys
08/13/2024, 9:58 AMbusiness
module. We are using kotlin.js.ir.output.granularity=per-file
(because we have some different types in different packages that have the same type name, and neither whole-program
nor per-module
support that).
Do someone have a sample working with these parameters ?
So far, we have come thus far with typescript configuration:
• "module": "ES2015", "moduleResolution": "Bundler"
which makes VSCode correctly resolve import { System } from 'test-js-export/kotlin/test-js-business/com/foo/test/business/System.export'
with the associated System.d.ts
file, but TypeScript compilation fails with ERR_MODULE_NOT_FOUND
.
• "module": "NodeNext", "moduleResolution": "NodeNext"
which makes TypeScript compile import { System } from 'test-js-export/kotlin/test-js-business/com/foo/test/business/System.export.mjs'
(note the .mjs
at the end of the import), and VSCode sees no problem, but it also gives no completion whatsoever as it seems the .d.ts
file is simply not read.turansky
08/13/2024, 10:49 AMbecause we have some different types in different packages that have the same type namePrefixes - is what umbrella packages use in such cases
salomonbrys
08/13/2024, 10:51 AMturansky
08/13/2024, 10:52 AMsalomonbrys
08/13/2024, 10:52 AMturansky
08/13/2024, 10:54 AMsalomonbrys
08/13/2024, 10:54 AMper-module
mode.turansky
08/13/2024, 10:55 AMsalomonbrys
08/13/2024, 10:55 AMturansky
08/13/2024, 10:56 AMsalomonbrys
08/13/2024, 10:56 AMturansky
08/13/2024, 10:56 AM@JsName("BaseA")
class A
// in other package
@JsName("CommonA")
class A
salomonbrys
08/13/2024, 10:57 AMper-module
or on the per-file
mode, so while prefixes allows us to use per-module
, it does not fix our issue.Edoardo Luppi
08/13/2024, 11:28 AMEdoardo Luppi
08/13/2024, 11:32 AMmodule
should be ES2015
, and moduleResolution
should be nodenext
, as Node effectively supports both ESM and CommonJS.Edoardo Luppi
08/13/2024, 11:47 AMpackage.json
file contains a "types": "name.d.ts"
entry.
However as far as I can see that root level file isn't actually produced.turansky
08/13/2024, 11:48 AMPrefixing everything is a mess, it ruins the DevExIt's what multiplatform libraries like
yFiles
do during migration on ES modulessalomonbrys
08/13/2024, 12:41 PMArtem Kobzar
08/13/2024, 2:22 PMd.ts
file like System.exports.d.ts
but as far as I remember nobody has implemented a per-file linking between TypeScript definition files so, this can be the problem you faced
per-file
is still experimental and we are still trying to fix a lot of issues with itEdoardo Luppi
08/14/2024, 9:24 AMper-file
needs to output typings that link to each other to be worth using.Edoardo Luppi
08/14/2024, 9:28 AM