Open
Description
There seem to be some improvements we can make to the usage of the average types. With improved type generation that is now available, it is viable to update tsconfig.json
for typescript projects to include the following:
"types": [
"./generated/types/wit.d.ts"
],
Generally, the required modules for a component are then included and can be used freely from the component code like so:
import type { run as wasiCliRun } from "wasmcloud:examples/component";
export const run: typeof wasiCliRun = {
async runNot() {
// ...
}
};
This is much better than the current method of adding individual d.ts
files to compilerOptions.paths
assuming it does not break.
A better long-term solution/feature that will solve this is to:
- Create templates based on the worlds we know our users are targeting
- Modify
tsconfig.json
files if present to ensure that the appropriatecompilerOptions.types
/compilerOptions.paths
values are set.
For those who will take on this issue, feel free to implement either (or some new solution that seems workable)!
P.S. This is also a great time to add a Typescript example.