Skip to content

Commit

Permalink
fix(typescript): do not permit unknown keys on instance
Browse files Browse the repository at this point in the history
fixes #31
  • Loading branch information
gr2m committed Apr 5, 2021
1 parent 3e0da09 commit 9d05e5b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ type Options = {
[key: string]: unknown;
};

type ApiExtension = { [key: string]: any };
type ApiExtension = { [key: string]: unknown };
type TestPlugin = (
instance: Base,
options: Options
Expand Down Expand Up @@ -46,7 +46,7 @@ export class Base {
);
};

return BaseWithPlugins as typeof BaseWithPlugins &
return BaseWithPlugins as typeof this & { plugins: any[] } &
Constructor<UnionToIntersection<ReturnTypeOf<T1> & ReturnTypeOf<T2>>>;
}

Expand All @@ -57,7 +57,7 @@ export class Base {
}
};

return BaseWitDefaults;
return BaseWitDefaults as typeof this;
}

constructor(options: Options = {}) {
Expand All @@ -72,4 +72,4 @@ export class Base {
}

options: Options;
}
}

0 comments on commit 9d05e5b

Please sign in to comment.