rete icon indicating copy to clipboard operation
rete copied to clipboard

Issue implementing rete using typescript

Open mzeeshanwahid opened this issue 5 years ago • 1 comments

I am trying to implement rete.js in a typescript project. I am able to see types under node_modules/rete/types but i am not able to use them. Can you help regarding this. I am creating component's in react like:

import * as React from "react";
import Rete from "rete";
import MyReactControl from "./MyReactControl";

class NumControl extends Rete.Control {

    constructor(emitter, key, readonly) { //emit, key, and readonly has explicitly type any
      super(key);
      this.render = 'react';  // Property 'render' does not exist on type 'NumControl'
      this.component = MyReactControl; // Property 'component' does not exist on type 'NumControl'
      
      this.key = key;
      this.props = { //Property 'props' does not exist on type 'NumControl'
        value: '',
        onChange: v => {
          this.setValue(v),
          emitter.trigger('process');
        },
        readonly,
        mounted: () => this.setValue(this.getData(this.key)) };
    }
    
    setValue(val) {
      this.props.value = val;
      this.putData(this.key, val)
      this.update(); // Property 'update' does not exist on type 'NumControl'
    }
  };

  export default NumControl;

Can you tell me how can we use types here?

mzeeshanwahid avatar Feb 11 '20 13:02 mzeeshanwahid

Same issue for me...

Haschtl avatar Jul 25 '21 14:07 Haschtl

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 10 days.

rete-js[bot] avatar Jul 13 '23 10:07 rete-js[bot]