Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[js/common] use TS type inference to eliminate unknown #23012

Merged
merged 3 commits into from
Dec 5, 2024

Conversation

fs-eire
Copy link
Contributor

@fs-eire fs-eire commented Dec 4, 2024

Description

This change uses a TypeScript trick to infer global types in onnxruntime-common. Thanks to the strong type system of TypeScript, we are able to refer to types that may not be available in the context.

This helps to keep onnxruntime-common not to include dependencies like "@webgpu/types", and still being able to use the types in the declaration. See comments of TryGetGlobalType in type-helper.ts.

@fs-eire fs-eire merged commit 1c79a4c into main Dec 5, 2024
95 checks passed
@fs-eire fs-eire deleted the fs-eire/ts-type-helper branch December 5, 2024 03:01
ankitm3k pushed a commit to intel/onnxruntime that referenced this pull request Dec 11, 2024
…3012)

### Description

This change uses a TypeScript trick to infer global types in
onnxruntime-common. Thanks to the strong type system of TypeScript, we
are able to refer to types that may not be available in the context.

This helps to keep onnxruntime-common not to include dependencies like
"@webgpu/types", and still being able to use the types in the
declaration. See comments of `TryGetGlobalType` in `type-helper.ts`.
ankitm3k pushed a commit to intel/onnxruntime that referenced this pull request Dec 11, 2024
…3012)

### Description

This change uses a TypeScript trick to infer global types in
onnxruntime-common. Thanks to the strong type system of TypeScript, we
are able to refer to types that may not be available in the context.

This helps to keep onnxruntime-common not to include dependencies like
"@webgpu/types", and still being able to use the types in the
declaration. See comments of `TryGetGlobalType` in `type-helper.ts`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants