microsoft / microsoft/TypeScript

Object.getOwnPropertyDescriptors accepts undefined (lib.es2017.object.d.ts)

Open
#31,175 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Bug Domain: lib.d.ts
Dominant language
Go
Stars
111k
Forks
14.3k
Avg merge
2d 4h
Merged PRs (30d)
132

Description

TypeScript Version: 3.4.5

Search Terms:
getOwnPropertyDescriptors

Code

Object.getOwnPropertyDescriptors(undefined);

Expected behavior:
Undefined is not accepted.

Actual behavior:
Undefined is accepted.

Playground Link:
https://www.typescriptlang.org/play/index.html#src=Object.getOwnPropertyDescriptors(undefined)%3B

However, can't seem to enable es2017 in the Playground

Related Issues:
n/a

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 lib.es2017.object.d.ts and the declaration for Object.getOwnPropertyDescriptors. Reproduce the issue with Object.getOwnPropertyDescriptors(undefined), then verify that the type checker rejects undefined while valid inputs remain accepted.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
compilers
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.