Skip to content

Supporting exactOptionalPropertyTypes #457

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

Closed
wants to merge 15 commits into from
Closed

Supporting exactOptionalPropertyTypes #457

wants to merge 15 commits into from

Conversation

seivan
Copy link
Contributor

@seivan seivan commented Nov 15, 2022

Superseded by #498

signal key has defined its key as optional, not necessarily the value even though this happens implicitly. No key means no value which translates to undefined:

    signal?: AbortSignal | null;

To support exactOptionalPropertyTypes it would have to be defined as:

    signal?: AbortSignal | null | undefined;

While you could say the key isn't optional (removing ?), which then requires an explicit undefined value:

    signal: AbortSignal | null | undefined;

That would require an explicit undefined being passed.

Given this key is part of TS definitions and module augmentation is overkill, just "oring" from undefined to an expected value (in this case null) solves the problem.

js2me and others added 15 commits October 28, 2022 03:15
docs: add Soarc as a contributor for code, and bug
…nbrock

docs: add JochenDiekenbrock as a contributor for code, and bug
`signal` key has defined its key as optional, not necessarily the value even though this happens implicitly. 
No key means no value which translates to `undefined`

```ts
    signal?: AbortSignal | null;
```

To support `exactOptionalPropertyTypes` it would have to be defined as 
```ts
    signal?: AbortSignal | null | undefined;
```
Since an optional key means an optional value, so the value has a chance of being `undefined` 

While you could say the key isn't optional, which then requires an explicit `undefined` value, e.g: 
```ts
    signal: AbortSignal | null | undefined;
```

That would require an explicit undefined being passed.
Given this key is part of TS definitions and module augmentation is overkill, just "oring" from undefined to an expected value (in this case `null`) solves the problem.
@js2me
Copy link
Member

js2me commented Nov 15, 2022

@seivan please use the next branch

@seivan seivan changed the base branch from master to next February 28, 2023 11:02
@seivan
Copy link
Contributor Author

seivan commented Feb 28, 2023

@js2me
Closed in favour of #498

@seivan seivan closed this Feb 28, 2023
@seivan seivan deleted the patch-1 branch February 28, 2023 11:06
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