refactor(core): add overloads to useVueFlow (#1481)
* refactor(core): add overloads to `useVueFlow` * chore(changeset): add * chore(core): cleanup
This commit is contained in:
@@ -14,6 +14,9 @@ export enum ErrorCode {
|
||||
EDGE_SOURCE_TARGET_SAME = 'EDGE_SOURCE_TARGET_SAME',
|
||||
EDGE_SOURCE_TARGET_MISSING = 'EDGE_SOURCE_TARGET_MISSING',
|
||||
EDGE_ORPHANED = 'EDGE_ORPHANED',
|
||||
|
||||
// deprecation errors
|
||||
USEVUEFLOW_OPTIONS = 'USEVUEFLOW_OPTIONS',
|
||||
}
|
||||
|
||||
const messages = {
|
||||
@@ -36,6 +39,10 @@ const messages = {
|
||||
[ErrorCode.EDGE_ORPHANED]: (id: string) =>
|
||||
`Edge was orphaned (suddenly missing source or target) and has been removed\nEdge: ${id}`,
|
||||
[ErrorCode.EDGE_NOT_FOUND]: (id: string) => `Edge not found\nEdge: ${id}`,
|
||||
|
||||
// deprecation errors
|
||||
[ErrorCode.USEVUEFLOW_OPTIONS]: () =>
|
||||
`The options parameter is deprecated and will be removed in the next major version. Please use the id parameter instead`,
|
||||
} as const
|
||||
|
||||
type ErrorArgs<T extends ErrorCode> = (typeof messages)[T] extends (...args: any[]) => string
|
||||
|
||||
Reference in New Issue
Block a user