fix: add return type for viz.destroy (#1744)

* fix: add return type for viz.destroy

* chore: type to void
This commit is contained in:
Tobias Åström
2025-05-12 15:00:36 +02:00
committed by GitHub
parent a9e6b4f40e
commit e838b21a15
3 changed files with 47 additions and 38 deletions

View File

@@ -145,6 +145,7 @@ export default function viz({
model,
/**
* Destroys the visualization and removes it from the the DOM.
* @returns {Promise<void>}
* @example
* const viz = await embed(app).render({
* element,

View File

@@ -1352,6 +1352,14 @@
"description": "Destroys the visualization and removes it from the the DOM.",
"kind": "function",
"params": [],
"returns": {
"type": "Promise",
"generics": [
{
"type": "void"
}
]
},
"examples": [
"const viz = await embed(app).render({\n element,\n id: 'abc'\n});\nviz.destroy();"
]
@@ -1730,6 +1738,33 @@
}
}
},
"Plugin": {
"description": "An object literal containing meta information about the plugin and a function containing the plugin implementation.",
"stability": "experimental",
"availability": {
"since": "1.2.0"
},
"kind": "interface",
"entries": {
"info": {
"description": "Object that can hold various meta info about the plugin",
"kind": "object",
"entries": {
"name": {
"description": "The name of the plugin",
"type": "string"
}
}
},
"fn": {
"description": "The implementation of the plugin. Input and return value is up to the plugin implementation to decide based on its purpose.",
"type": "function"
}
},
"examples": [
"const plugin = {\n info: {\n name: \"example-plugin\",\n type: \"meta-type\",\n },\n fn: () => {\n // Plugin implementation goes here\n }\n};"
]
},
"Field": {
"kind": "alias",
"items": {
@@ -1881,33 +1916,6 @@
}
}
},
"Plugin": {
"description": "An object literal containing meta information about the plugin and a function containing the plugin implementation.",
"stability": "experimental",
"availability": {
"since": "1.2.0"
},
"kind": "interface",
"entries": {
"info": {
"description": "Object that can hold various meta info about the plugin",
"kind": "object",
"entries": {
"name": {
"description": "The name of the plugin",
"type": "string"
}
}
},
"fn": {
"description": "The implementation of the plugin. Input and return value is up to the plugin implementation to decide based on its purpose.",
"type": "function"
}
},
"examples": [
"const plugin = {\n info: {\n name: \"example-plugin\",\n type: \"meta-type\",\n },\n fn: () => {\n // Plugin implementation goes here\n }\n};"
]
},
"LoadType": {
"kind": "interface",
"params": [

View File

@@ -430,7 +430,7 @@ declare namespace stardust {
/**
* Destroys the visualization and removes it from the the DOM.
*/
destroy(): void;
destroy(): Promise<void>;
/**
* Converts the visualization to a different registered type.
@@ -559,6 +559,16 @@ declare namespace stardust {
}
/**
* An object literal containing meta information about the plugin and a function containing the plugin implementation.
*/
interface Plugin {
info: {
name: string;
};
fn: ()=>void;
}
type Field = string | qix.NxDimension | qix.NxMeasure | stardust.LibraryField;
/**
@@ -600,16 +610,6 @@ declare namespace stardust {
type: "dimension" | "measure";
}
/**
* An object literal containing meta information about the plugin and a function containing the plugin implementation.
*/
interface Plugin {
info: {
name: string;
};
fn: ()=>void;
}
interface LoadType {
(type: {
name: string;