elf: Type 'P_1' cannot be used to index type...

Which @ngneat/elf-* package(s) are the source of the bug?

entities

Is this a regression?

No

Description

Created default repo with cli

const { state, config } = createState(
  withEntities<MyModelWithStringId>(),
  withActiveId(),
  withRequestsCache(),
  withRequestsStatus()
);

Trying to build then getting error.

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

Error: node_modules/@ngneat/elf-entities/lib/entity.state.d.ts:33:130 - error TS2536: Type 'P_1' cannot be used to index type '{ [K_1 in EntitiesKey | IdsKey]: K_1 extends EntitiesKey ? Record<EntityType[IdKey], EntityType> : K_1 extends IdsKey ? EntityType[IdKey][] : never; }'.

33     props: { [P_1 in (Feature extends "" ? "entities" : `${Feature}Entities`) | (Feature extends "" ? "ids" : `${Feature}Ids`)]: { [K_1 in EntitiesKey | IdsKey]: K_1 extends EntitiesKey ? Record<EntityType[IdKey], EntityType> : K_1 extends IdsKey ? EntityType[IdKey][] : never; }[P_1]; };

Please provide the environment you discovered this bug in

VSCode 1.61.0
Windows_NT x64 10.0.22000

"@angular/core": "~12.2.9",
"rxjs": "7.3.0",
"typescript": "~4.3.5",

"@ngneat/elf": "^1.0.0-beta.4",
"@ngneat/elf-devtools": "^1.0.0-beta.2",
"@ngneat/elf-entities": "^1.0.0-beta.5",
"@ngneat/elf-pagination": "^1.0.0-beta.2",
"@ngneat/elf-persist-state": "^1.0.0-beta.2",
"@ngneat/elf-requests": "^1.0.0-beta.4",
"@ngneat/elf-state-history": "^1.0.0-beta.2",

Anything else?

No response

Do you want to create a pull request?

No

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 15 (8 by maintainers)

Most upvoted comments