-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Closed
Labels
DuplicateAn existing issue was already createdAn existing issue was already createdSuggestionAn idea for TypeScriptAn idea for TypeScript
Description
We currently have two jsx modes, preserve and react. Using preserve leaves the <Something /> for an additional compilation step, and react ties you into using the React library. I want to propose a compiler option which allows you to define the emitted types. For example setting:
"jsx": {createElement: "el"}
Which would transform this code:
let test = <div><span /><span /></div>;
Into this result:
var test = el("div", null, el("span", null), el("span", null));
Essentially, replacing React.createElement with el. Now I can define an el function like:
(name: string, properties: {[key: string]: string}, ...children: MyElement[]) => MyElement
To implement an own library. Why? Because some of us don't like being forced into using React, and this would allow us to either create our own libraries or use an existing DSL such as virtual-hyperscript (perhaps with some minor modifications there).
Metadata
Metadata
Assignees
Labels
DuplicateAn existing issue was already createdAn existing issue was already createdSuggestionAn idea for TypeScriptAn idea for TypeScript