Replies: 1 comment 9 replies
-
|
So I somewhat get to answer my question... The first step is to make tsc output type definitions for the host. This can be accomplished by adding to the host's manifest: "typescript": {
"tsconfig": {
"compilerOptions": {
"declaration": true,
"declarationDir": "../../../../../../../../types"
}
}
}This causes the build dir to have a directory tree with the type definitions. The second step is to reference those type definitions in the module, again using the manifest: "typescript": {
"tsconfig": {
"compilerOptions": {
"paths": {
"embedded:network/http/rest-server": [
"/home/src/moddable/js-board/host/build/types/modules/lib/rest-server/rest-server"
]
},
"rootDirs": [".", "../host/build/types"]
}
}
}The rootDirs option adds the types tree from step 1 into the build of the mod. However, the module called "embedded:network/http/rest-server" is in that tree at "modules/lib/rest-server" so I had to create an explicit mapping using the paths. Oddly the '../host' reference worked in rootDirs but a similar relative reference doesn't work in paths... So the remaining issue here is that the module name mappings captured in various manifests needs to be recreated manually. This is something mcrun could help with... |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm having a problem with typescript modules and mcrun. The problem is how to reference typescript modules found in the host without double-loading them into the mod. In detail:
If the host is written in javascript, then the manifest of the mod can point to an A.d.ts file, which satisfies tsc. So right now the only solution I see is to create a redundant A.d.ts file for my module A.ts? It seems what is needed is a "typescript_include" section in the mod's manifest for modules that need to go into the tsconfig.json but not into the final archive. I have the feeling I'm missing some obvious solution?
Beta Was this translation helpful? Give feedback.
All reactions