microsoft / microsoft/vscode-wasm

wit async func wit2ts error

Open
#240 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
456
Forks
40
Avg merge
3d 2h
Merged PRs (30d)
4

Description

world calculator {
	use types.{ operation, error-code };
	import log: func(msg: string);

	export calc: func(o: operation) -> result<u32, error-code>;
	export get: async func() -> string;
}

wasm-component-model@1.0.0 generate:model

wit2ts --outDir ./src ./wit

Debugger attached.
Failed to process document
TypeError: Cannot read properties of undefined (reading 'world')
at Object.isWorld (/Users/lamb/Downloads/vscode-extension-samples-main/wasm-component-model/node_modules/@vscode/wasm-component-model/lib/tools/wit-json.js:146:29)
at SymbolTable.resolveOwner (/Users/lamb/Downloads/vscode-extension-samples-main/wasm-component-model/node_modules/@vscode/wasm-component-model/lib/tools/wit2ts.js:702:30)
at WorldExportFunctionEmitter.getOwner (/Users/lamb/Downloads/vscode-extension-samples-main/wasm-component-model/node_modules/@vscode/wasm-component-model/lib/tools/wit2ts.js:2789:60)
at new MemberEmitter (/Users/lamb/Downloads/vscode-extension-samples-main/wasm-component-model/node_modules/@vscode/wasm-component-model/lib/tools/wit2ts.js:2767:27)
at new FunctionEmitter (/Users/lamb/Downloads/vscode-extension-samples-main/wasm-component-model/node_modules/@vscode/wasm-component-model/lib/tools/wit2ts.js:2852:9)
at new WorldExportFunctionEmitter (/Users/lamb/Downloads/vscode-extension-samples-main/wasm-component-model/node_modules/@vscode/wasm-component-model/lib/tools/wit2ts.js:2903:9)
at new (/Users/lamb/Downloads/vscode-extension-samples-main/wasm-component-model/node_modules/@vscode/wasm-component-model/lib/tools/wit2ts.js:3684:13)
at WorldEmitter.build (/Users/lamb/Downloads/vscode-extension-samples-main/wasm-component-model/node_modules/@vscode/wasm-component-model/lib/tools/wit2ts.js:2057:48)
at PackageEmitter.build (/Users/lamb/Downloads/vscode-extension-samples-main/wasm-component-model/node_modules/@vscode/wasm-component-model/lib/tools/wit2ts.js:1889:21)
at DocumentEmitter.build (/Users/lamb/Downloads/vscode-extension-samples-main/wasm-component-model/node_modules/@vscode/wasm-component-model/lib/tools/wit2ts.js:1797:24)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure with wasm-component-model@1.0.0 generate:model and the shown calculator WIT document. Start with the stack-trace locations in lib/tools/wit-json.js and lib/tools/wit2ts.js, especially isWorld and WorldExportFunctionEmitter. Done means the async world export no longer causes the generator to fail and TypeScript output is produced.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, wasm
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.