Skip to content

Commit

Permalink
Fix #3425: recursive typescript declaration errors
Browse files Browse the repository at this point in the history
TypeScript doesn't like the recursiveness of the current typings. This is
a quickfix that gets rid of some of the recursiveness, by trading in some
type safety.
  • Loading branch information
seijikun authored and evs-chris committed Mar 14, 2024
1 parent 50ee434 commit a6e1241
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion typings/ractive.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,16 @@ export class ContextHelper {
unshift(keypath: string, value: any): ArrayPushPromise;
}

export type Component = Static<any> | Promise<Static<any>>;
/**
* Interface for something that looks like a Ractive constructor.
* This is used in places, where the recursive typing declarations would otherwise cause TypeScript errors.
* (see #3425)
*/
interface CanComponent {
new(opts?: InitOpts): { root: Ractive; };
}
export type Component = CanComponent | Promise<CanComponent>;


export type ComponentItem = {
instance: Ractive<any>;
Expand Down

0 comments on commit a6e1241

Please sign in to comment.