Getting below error while compiling TypeScript file in Ember
TypeScript Version - 3.2.2, Ember-Cli: 3.6.1, Node: 10.13.0
Getting below error while compiling TypeScript file in Ember
TypeScript Version - 3.2.2, Ember-Cli: 3.6.1, Node: 10.13.0
Are you using ember-cli-typescript, if so, what version?
The first error is most likely happening because you have not added any models to the ModelRegistry
and you don’t have a “catch all” to tell TS that the ModelRegistry contains string keys (and thus the type for keyof ModelRegistry
is never
). For each of your models, you need to add some code to add it to the ModelRegistry
. See GitHub - typed-ember/ember-cli-typescript: Use TypeScript in your Ember.js apps! for more info.
For the second error, somehow the array type has lost its find method? Not exactly sure what’s happening here.
TypeScript version is - 3.2.4
“typescript”: “^3.2.4”
Thank You!
I am able to fix my 1st error by adding following code to @types/ember-data/index.d.ts
declare module 'ember-data/types/registries/model' {export default interface ModelRegistry { [key: string]: any; }}
But I am still fighting with second issue.
Fixed the second issue also by declaring find() as given in below in - @types/ember-array/-private/enumarable.d.ts
find(predicate: (value: T, index: number, obj: Array<T>) => boolean, thisArg?: any): T;
I’m specifically asking about ember-cli-typescript
the library GitHub - typed-ember/ember-cli-typescript: Use TypeScript in your Ember.js apps!