-
Notifications
You must be signed in to change notification settings - Fork 258
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Property 'name' does not exist on type 'Component'.ts(2339) #1035
Comments
Workaround import { INoFloNodeJSComponent, INoFloNodeJSComponentPort, INoFloUIComponent, INoFloUIComponentPort } from 'the-graph';
/**
* Covert FBP Protocol component to the-graph library component
* @url https://github.com/noflo/noflo-ui/blob/22d26eca71b52cd5181dd253f76bdb13c6bfecd4/src/runtime.js#L17C1-L33
*/
export function componentForLibrary(component: INoFloNodeJSComponent): INoFloUIComponent {
return {
name: component.name,
icon: component.icon ?? 'cog',
description: component.description ?? '',
subgraph: component.subgraph ?? false,
inports: component.inPorts?.map(portForLibrary) ?? [],
outports: component.outPorts?.map(portForLibrary) ?? [],
};
}
function portForLibrary(port: INoFloNodeJSComponentPort): INoFloUIComponentPort {
return {
name: port.id,
type: port.type,
description: port.type,
addressable: port.addressable,
schema: port.schema,
};
} and makeshift typing declare module 'the-graph' {
import { Graph } from 'fbp-graph';
export interface ITheGraphProps {
getMenuDef?: (options: {
graph: any;
item: any;
itemKey: any;
type: string;
}) => any;
graph: Graph;
height: number | string;
library?: IFBPLibrary;
offsetX?: number;
onPanScale: (x: number, y: number, scale: number) => void;
readonly: boolean;
ref?: RefObject<HTMLDivElement>;
width: number | string;
}
export function App(props: ITheGraphProps): JSX.Element;
export interface INoFloNodeJSComponentPort {
addressable: boolean;
id: string;
schema: string;
type: string;
}
export interface INoFloUIComponentPort extends Omit<INoFloNodeJSComponentPort, 'id'> {
description: string;
name: string;
}
function componentsFromGraph(graph: Graph): INoFloUIComponent[];
export interface INoFloUIComponent {
description: string;
icon: string;
inports?: INoFloUIComponentPort[];
name: string;
outports?: INoFloUIComponentPort[];
/**
* True means this is not a Elementary component
*/
subgraph?: boolean;
unnamespaced?: boolean;
}
export interface INoFloNodeJSComponent extends Omit<INoFloUIComponent, 'inports' | 'outports'> {
inPorts?: INoFloNodeJSComponentPort[];
outPorts?: INoFloNodeJSComponentPort[];
}
export type IFBPLibrary = Record<string, INoFloUIComponent>;
function libraryFromGraph(graph: Graph): IFBPLibrary;
export const library = {
componentsFromGraph,
libraryFromGraph,
};
function styleFromTheme(theme: 'dark' | 'light'): {
height: number;
lineWidth: number;
nodeSize: number;
width: number;
};
function renderThumbnail(contextcontext: CanvasRenderingContext2D | null, graph: Graph, properties: ReturnType<typeof styleFromTheme>): {
rectangle: number[];
scale: number;
};
export const thumb = {
styleFromTheme,
render: renderThumbnail,
};
export interface ITheGraphNavProps {
graph: Graph;
height: number;
onPanTo: () => void;
onTap: () => void;
viewrectangle: number[];
viewscale: number;
width: number;
}
function NavComponent(props: ITheGraphNavProps): JSX.Element;
export const nav = {
Component: NavComponent,
};
} |
linonetwo
added a commit
to tiddly-gittly/TidGi-Desktop
that referenced
this issue
Jul 12, 2023
linonetwo
added a commit
to tiddly-gittly/TidGi-Desktop
that referenced
this issue
Jul 17, 2023
linonetwo
added a commit
to tiddly-gittly/TidGi-Desktop
that referenced
this issue
Jul 17, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Property 'subgraph' does not exist on type 'Component'. Did you mean 'isSubgraph'?ts(2551)
Property 'map' does not exist on type 'InPorts'.ts(2339)
Property 'map' does not exist on type 'OutPorts'.ts(2339)
So what is the type for https://github.com/noflo/noflo-ui/blob/22d26eca71b52cd5181dd253f76bdb13c6bfecd4/components/RuntimeReducer.js#L74-L76
To fix flowhub/the-graph#622 ?
The text was updated successfully, but these errors were encountered: