Skip to content

Intl types: Better typing for exactOptionalPropertyTypes needed #45652

Closed
@HolgerJeromin

Description

@HolgerJeromin

Bug Report

I did not find a "planning" issue for related issues.
All delivered types should be safe to use with the new Typescript option.

🕗 Version & Regression Information

  • I was unable to test this on prior versions because this is a new option

⏯ Playground Link

// @exactOptionalPropertyTypes
const IntlOptions: Intl.DateTimeFormatOptions = {
    timeZone: undefined
};

Workbench Repro

🙁 Actual behavior

Type 'undefined' is not assignable to type 'string'.(2322)

🙂 Expected behavior

Should compile because undefined is a valid property for that object.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat

copied from microsoft/TypeScript-DOM-lib-generator#1126

Metadata

Metadata

Assignees

Labels

Domain: lib.d.tsThe issue relates to the different libraries shipped with TypeScript

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions