Skip to content

Instantly share code, notes, and snippets.

@mathieu-anderson
Last active September 5, 2019 07:31
Show Gist options
  • Save mathieu-anderson/d12cb89ff4d947f339e6c34e024e7602 to your computer and use it in GitHub Desktop.
Save mathieu-anderson/d12cb89ff4d947f339e6c34e024e7602 to your computer and use it in GitHub Desktop.
Inline types
import * as React from "react";
import { render } from "react-dom";
// Inline types
function InlineTsInput(props: { value: number | string; label: string }) {
const { value, label } = props;
return (
<div className="container">
<div className="label">{label}</div>
<div className="typeof">
Type: <b>{typeof value}</b>
</div>
<input value={value} />
</div>
);
}
function App() {
return (
<div className="App">
<InlineTsInput value={1} label="TS inline types" />
</div>
);
}
const rootElement = document.getElementById("root");
render(<App />, rootElement);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment