@babel/types#JSX TypeScript Examples

The following examples show how to use @babel/types#JSX. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BadComponent.tsx    From abacus with GNU General Public License v2.0 5 votes vote down vote up
export default function BadComponent(): JSX.Element {
  // Need a component that will fail when React attempts to render but also need
  // something that TypeScript will compile. The type assertion allows TS to
  // compile successfully but because we essentially lied to TS, it will fail as
  // runtime.
  return <>{(obj as { nonExistent: { boom: 'shaka laka' } }).nonExistent.boom}</>
}