microsoft / microsoft/TypeScript

Spread with enum index key, invalid members don't trigger errors

Open
#32,236 5 comments 7 reactions 1 assignee View on GitHub

@ahejlsberg is already working on this.

Since Jul 3, 2019.

Needs Investigation
Dominant language
Go
Stars
111k
Forks
14.3k
Avg merge
2d 4h
Merged PRs (30d)
132

Description

TypeScript Version: 3.5.1

Search Terms:
object spread enum index missing keys

Code
Playground link has code

Expected behavior:
Missing keys & incorrect value types when I build a nested object using the spread operator with index keys, ought to throw errors for invalid types

Actual behavior:
It seems like the child object can have whatever shape I want, the types aren't being checked at all

Playground Link: This is same as above playground link

Related Issues: I'm not really sure what the root limitation that's causing this is so it's hard for me to find similar issues.

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.