Skip to content

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

@yume-chan

Description

@yume-chan

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

webcodecs/index.src.html

Lines 1565 to 1568 in 46eaed1

dictionary AudioDecoderSupport {
boolean supported;
AudioDecoderConfig config;
};

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    editorialchanges to wording, grammar, etc that don't modify the intended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions