Fix type inference for the public interface of plugins created with the zeppelinPlugin() helper
This commit is contained in:
parent
4019b9e1a2
commit
a848e00fdd
1 changed files with 11 additions and 4 deletions
|
@ -8,11 +8,18 @@ export interface ZeppelinPluginBlueprint<TPluginType extends BasePluginType = Ba
|
||||||
showInDocs?: boolean;
|
showInDocs?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function zeppelinPlugin(name: string, blueprint: Omit<ZeppelinPluginBlueprint, "name">): ZeppelinPluginBlueprint;
|
export function zeppelinPlugin<TPartialBlueprint extends Omit<ZeppelinPluginBlueprint, "name">>(
|
||||||
export function zeppelinPlugin<TPluginType extends BasePluginType>(): (
|
|
||||||
name: string,
|
name: string,
|
||||||
blueprint: Omit<ZeppelinPluginBlueprint<TPluginType>, "name">,
|
blueprint: TPartialBlueprint,
|
||||||
) => ZeppelinPluginBlueprint<TPluginType>;
|
): TPartialBlueprint & { name: string };
|
||||||
|
|
||||||
|
export function zeppelinPlugin<TPluginType extends BasePluginType>(): <
|
||||||
|
TPartialBlueprint extends Omit<ZeppelinPluginBlueprint<TPluginType>, "name">
|
||||||
|
>(
|
||||||
|
name: string,
|
||||||
|
blueprint: TPartialBlueprint,
|
||||||
|
) => TPartialBlueprint & { name: string };
|
||||||
|
|
||||||
export function zeppelinPlugin(...args) {
|
export function zeppelinPlugin(...args) {
|
||||||
if (args.length) {
|
if (args.length) {
|
||||||
const blueprint: ZeppelinPluginBlueprint = plugin(...(args as Parameters<typeof plugin>));
|
const blueprint: ZeppelinPluginBlueprint = plugin(...(args as Parameters<typeof plugin>));
|
||||||
|
|
Loading…
Add table
Reference in a new issue