Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Typescript] Unable to define afterCreate in factory (type error) #791

Open
josemarluedke opened this issue Feb 16, 2021 · 4 comments · May be fixed by #1019
Open

[Typescript] Unable to define afterCreate in factory (type error) #791

josemarluedke opened this issue Feb 16, 2021 · 4 comments · May be fixed by #1019

Comments

@josemarluedke
Copy link

Trying to define a factory with afterCreate in typescript gives the following error:

 Type '(provider: { id?: string | undefined; attrs: Record<string, unknown>; modelName: string; save(): void; update<K extends never>(key: K, value: {}[K]): void; update(changes: Partial<{}>): void; destroy(): void; reload(): void; }, server: Server<...>) => void' is not assignable to type '(n: number) => void'.
const myModel  = Factory.extend({
  // stuff

  afterCreate(provider: ModelInstance, server: Server) {
     // stuff
  }
})
@renelopez
Copy link

Any updates on this? Having this issue on last version

@IanVS
Copy link
Collaborator

IanVS commented Oct 12, 2021

I'd be happy to review a PR that adds or fixes the type definition.

@Istanful
Copy link

Istanful commented Feb 9, 2022

I'll take a shoot at this.

@Istanful Istanful linked a pull request Feb 9, 2022 that will close this issue
@Istanful
Copy link

Istanful commented Feb 9, 2022

@IanVS I've opened a pull request. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants