Skip to content

Commit d878c5b

Browse files
committed
fix: add missing ref prop to react typings
1 parent ead4ef5 commit d878c5b

File tree

2 files changed

+24
-22
lines changed

2 files changed

+24
-22
lines changed

_templates/element/new/react-types.ts.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ inject: true
44
before: \}\s+\}\s+\}
55
skip_if: 'wokwi-<%= name %>'
66
---
7-
'wokwi-<%= name %>': Partial<<%= h.className(name) %>Element>;
7+
'wokwi-<%= name %>': WokwiElement<<%= h.className(name) %>Element>;

src/react-types.ts

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -23,30 +23,32 @@ import { LEDRingElement } from './led-ring-element';
2323
import { SlideSwitchElement } from './slide-switch-element';
2424
import { HCSR04Element } from './hc-sr04-element';
2525

26+
type WokwiElement<T> = Partial<T> & React.ClassAttributes<T>;
27+
2628
declare global {
2729
namespace JSX {
2830
interface IntrinsicElements {
29-
'wokwi-7segment': Partial<SevenSegmentElement>;
30-
'wokwi-arduino-uno': Partial<ArduinoUnoElement>;
31-
'wokwi-lcd1602': Partial<LCD1602Element>;
32-
'wokwi-led': Partial<LEDElement>;
33-
'wokwi-neopixel': Partial<NeoPixelElement>;
34-
'wokwi-pushbutton': Partial<PushbuttonElement>;
35-
'wokwi-resistor': Partial<ResistorElement>;
36-
'wokwi-membrane-keypad': Partial<MembraneKeypadElement>;
37-
'wokwi-potentiometer': Partial<PotentiometerElement>;
38-
'wokwi-neopixel-matrix': Partial<NeopixelMatrixElement>;
39-
'wokwi-ssd1306': Partial<SSD1306Element>;
40-
'wokwi-buzzer': Partial<BuzzerElement>;
41-
'wokwi-rotary-dialer': Partial<RotaryDialerElement>;
42-
'wokwi-servo': Partial<ServoElement>;
43-
'wokwi-dht22': Partial<DHT22Element>;
44-
'wokwi-arduino-mega': Partial<ArduinoMegaElement>;
45-
'wokwi-arduino-nano': Partial<ArduinoNanoElement>;
46-
'wokwi-ds1307': Partial<Ds1307Element>;
47-
'wokwi-neopixel-ring': Partial<LEDRingElement>;
48-
'wokwi-slide-switch': Partial<SlideSwitchElement>;
49-
'wokwi-hc-sr04': Partial<HCSR04Element>;
31+
'wokwi-7segment': WokwiElement<SevenSegmentElement>;
32+
'wokwi-arduino-uno': WokwiElement<ArduinoUnoElement>;
33+
'wokwi-lcd1602': WokwiElement<LCD1602Element>;
34+
'wokwi-led': WokwiElement<LEDElement>;
35+
'wokwi-neopixel': WokwiElement<NeoPixelElement>;
36+
'wokwi-pushbutton': WokwiElement<PushbuttonElement>;
37+
'wokwi-resistor': WokwiElement<ResistorElement>;
38+
'wokwi-membrane-keypad': WokwiElement<MembraneKeypadElement>;
39+
'wokwi-potentiometer': WokwiElement<PotentiometerElement>;
40+
'wokwi-neopixel-matrix': WokwiElement<NeopixelMatrixElement>;
41+
'wokwi-ssd1306': WokwiElement<SSD1306Element>;
42+
'wokwi-buzzer': WokwiElement<BuzzerElement>;
43+
'wokwi-rotary-dialer': WokwiElement<RotaryDialerElement>;
44+
'wokwi-servo': WokwiElement<ServoElement>;
45+
'wokwi-dht22': WokwiElement<DHT22Element>;
46+
'wokwi-arduino-mega': WokwiElement<ArduinoMegaElement>;
47+
'wokwi-arduino-nano': WokwiElement<ArduinoNanoElement>;
48+
'wokwi-ds1307': WokwiElement<Ds1307Element>;
49+
'wokwi-neopixel-ring': WokwiElement<LEDRingElement>;
50+
'wokwi-slide-switch': WokwiElement<SlideSwitchElement>;
51+
'wokwi-hc-sr04': WokwiElement<HCSR04Element>;
5052
}
5153
}
5254
}

0 commit comments

Comments
 (0)