I just tried creating my own Plugin, but i seem to face a problem with the normalize function.
Using the MyPlugin Sample:
interface MyPluginInput {
value: number
multiplier?: number
}
export const myPlugin = createPlugin<MyPluginInput, number, MyPluginSettings>({
component: MyComponent,
normalize: (input) => ({
value: input.value ?? 0,
settings: { multiplier: input.multiplier ?? 1 },
}),
sanitize: (value) =>value,
format: (value, settings) => (value * settings.multiplier).toFixed(2),
})
This is the typescript documentation on the normalize function
(property) Plugin<MyPluginInput, number, MyPluginSettings>.normalize?: ((input: MyPluginInput, path: string, data: Data) => {
value: number;
settings?: MyPluginSettings | undefined;
}) | undefined
Normalizes the input into a { value, settings } object.
but at runtime input is actualy the value (10), not an object of type MyPluginInput:
is the documentation not up to date, or am i missing a setting?
If required i can provide additional information.
I just tried creating my own Plugin, but i seem to face a problem with the normalize function.
Using the MyPlugin Sample:
This is the typescript documentation on the normalize function
but at runtime input is actualy the value (10), not an object of type MyPluginInput:
is the documentation not up to date, or am i missing a setting?
If required i can provide additional information.