Skip to content

Commit 2f32185

Browse files
committed
Add support for using IntrinsicElements.
1 parent 0af0ac0 commit 2f32185

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "simple-tsx",
3-
"version": "1.1.0",
3+
"version": "1.2.0",
44
"description": "A simple way to write tsx files. No babel required!",
55
"main": "dist/index.js",
66
"type": "commonjs",

src/element.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
import { AttributesType } from "./types";
1+
import { AttributeValueType, AttributesType } from "./types";
22

33
export default class Element {
44
element: HTMLElement;
55

6+
// This will allow you to use this class for IntrinsicElements. I know this is a hacky way to do things but I don't have anything better.
7+
[name: string]: AttributeValueType | HTMLElement;
8+
69
constructor(
710
tagName: string,
811
attributes: AttributesType | null,

src/types.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
export type AttributeValueType = string | ((event: Event) => unknown);
2+
13
export type AttributesType = {
2-
[key: string]: string | ((event: Event) => unknown);
4+
[key: string]: AttributeValueType;
35
};

0 commit comments

Comments
 (0)