Skip to content

fix(lib/es2015): Fix types of Reflect methods - #41987

Merged
Orta Therox (orta) merged 1 commit into
microsoft:masterfrom
ExE-Boss:lib/es2015/fix-reflect-method-types
Jan 4, 2021
Merged

fix(lib/es2015): Fix types of Reflect methods#41987
Orta Therox (orta) merged 1 commit into
microsoft:masterfrom
ExE-Boss:lib/es2015/fix-reflect-method-types

Conversation

@ExE-Boss

@ExE-Boss ExE Boss (ExE-Boss) commented Dec 16, 2020

Copy link
Copy Markdown
Contributor

Unlike #35608, this only fixes the types so that the return types of Reflect.ownKeys(…) and Reflect.getPrototypeOf(…) are correct.

Blocks:


Fixes #34626

/cc Jessica Franco (@Jessidhia) Orta Therox (@orta) Ron Buckton (@rbuckton) Nathan Shively-Sanders (@sandersn)

@typescript-bot TypeScript Bot (typescript-bot) added the For Uncommitted Bug PR for untriaged, rejected, closed or missing bug label Dec 16, 2020
@typescript-bot

Copy link
Copy Markdown
Contributor

This PR doesn't have any linked issues. Please open an issue that references this PR. From there we can discuss and prioritise.

@orta

Orta Therox (orta) commented Jan 4, 2021

Copy link
Copy Markdown
Contributor

I compared each function to the MDN docs for the reflect API, and that all seems to look right to me - thanks ExE Boss (@ExE-Boss)

@monfera

Copy link
Copy Markdown

ExE Boss (@ExE-Boss) great change, thanks! Looks like lib/lib.es2015.reflect.d.ts needs to be updated for userland code who install via eg. yarn and "typescript": "microsoft/TypeScript#master", in the devDependencies; also tried yarn add -D typescript@next, still getting the old definitions from lib/lib.es2015.reflect.d.ts. Maybe there's some extra build step?

@Luxcium

Benjamin Vincent (Luxcium) commented Jan 6, 2021

Copy link
Copy Markdown

I would like to know what is the return type of Reflect.ownKeys(target) is it of Type '(string | number | symbol)[]' or of Type '(string | symbol)[]' ??? (Sorry to be so confused I am the kind of person who likes to annotate all my functions output types and now I am using /* : (string | number | symbol)[] */ yes with the /* and the */ haha !!!

Screenshot_20210105_230211

@ExE-Boss

Copy link
Copy Markdown
Contributor Author

Benjamin Vincent (@Luxcium) The correct return type of Reflect.ownKeys(target) is (string | symbol)[]:

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

For Uncommitted Bug PR for untriaged, rejected, closed or missing bug

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Reflect.ownKeys has overly wide type definition

6 participants