E407 `fromEntries`: imprecise type when type of key is a template literal that can't be simplified to another type · Issue #1179 · remeda/remeda · GitHub
[go: up one dir, main page]

Skip to content

fromEntries: imprecise type when type of key is a template literal that can't be simplified to another type #1179

@hab25

Description

@hab25
// tsconfig.json
{
  "compilerOptions": {
    "exactOptionalPropertyTypes": true
  }
}
/*
Type:
{[p: `${string}foo`]: string | undefined}
Type should be:
{[p: `${string}foo`]: string}
*/
R.fromEntries([] as [`${string}foo`, string][]);

/*
This type is fine!
Type: {[p: string]: string}
*/
R.fromEntries([] as [`${string}`, string][]);

Metadata

Metadata

Assignees

Labels

typingSomething type related

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0