w3c / w3c/webcodecs

Definitely assigned fields in return value dictionaries should be marked as `required`

Open
#381 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

editorial
Dominant language
HTML
Stars
1.3k
Forks
194
Avg merge
1d 13h
Merged PRs (30d)
3

Description

The TypeScript definition for webcodecs in DefinitelyTyped is outdated, so I'm trying to generate a new one from official IDL using a modified version of microsoft/TypeScript-DOM-lib-generator. It worked, but old tests didn't pass.

The reason is that the old version was generated from Chromium IDL, which differs from official IDL.

For example, AudioDecoderSupport dictionary in official IDL is

https://github.com/w3c/webcodecs/blob/46eaed12fa374cd530986f4ad34ab0723463b8d0/index.src.html#L1565-L1568

and Chromium version

dictionary AudioDecoderSupport {
  required boolean supported;
  required AudioDecoderConfig config;
};

Looking at related steps, these fields are definitely assigned, so the required keyword is correct.

Marking them as required more precisely reflects shape of the value, and TypeScript-DOM-lib-generator needs them to generate more correct type definitions.

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

Start with the linked official WebCodecs IDL in index.src.html and compare the AudioDecoderSupport definition with the Chromium IDL linked in the issue. Check the related algorithm steps and the old test results, then verify that definitely assigned dictionary fields are represented as required and that the existing tests pass.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.