Skip to content

A "fun" implementation of a JSX rendering engine similar to React's ... in the TypeScript type system.

License

Notifications You must be signed in to change notification settings

JoshuaKGoldberg/type-system-react

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Type System React

A "fun" implementation of a JSX rendering engine similar to React's ... in the TypeScript type system.

export type ComponentRegistry = {
  Emoji: "💖";
  Heading: "<h1>{children}</h1>";
};

export type Result = Render<"<Heading>Hello, world! <Emoji /></Heading>">;

export type PrintMe = Result;
//          ^? type PrintMe = "<h1>Hello, world! 💖</h1>"

End Goal

This walkthrough includes:

  • Rendering a self-closing element
  • Rendering an element with {children}
  • Component registry
  • Bugs (probably) (almost certainly) (definitely)

It does not include:

  • Space-sensitive parsing
  • Props other than children
  • Logic, including hooks or state
  • React Server Components

What's Inside

  1. src/foundations: Building up most of the general TypeScript syntax features we'll use to implement our JSX renderer
  2. src/fun: Building up the JSX renderer using the foundational features

See the README.md files within each step, such as src/foundations/0-types/README.md.

About

A "fun" implementation of a JSX rendering engine similar to React's ... in the TypeScript type system.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published