microsoft / microsoft/node-api-dotnet

TypeScript definition for ValueType not found

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

Nobody has claimed this yet.

Dominant language
C#
Stars
783
Forks
80
PR merge metrics
No merged PRs in 30d

Description

When generating JavaScript/TypeScript for a very simple C# struct:

[JSExport] public struct Interface { ...

In the .d.ts file following is generated:

import './System.Collections';
import './System.Runtime';

export class Interface extends ValueType {...

ValueType is unknown to the typescript compiler:

Image

Where is the TypeScript definition for ValueType or how can I avoid the TypeScript compiler error? Obviously there is no issue during runtime.

Is this an issue or do I overlook something?

Contributor guide

Open the contributing guide

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 simple C# struct with [JSExport] and inspect the generated .d.ts file, especially the Interface declaration and its ValueType reference. Check how the TypeScript compiler resolves the generated imports and determine whether the completed work should provide a ValueType definition or document a way to avoid the compiler error.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, typescript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.