Skip to main content

Module typescript

Module typescript 

Source
Expand description

Rendering the TypeScript CST. Spec §5.

One style, the one prettier produces and every TypeScript project in this repository is written in: two spaces, the opening brace on the same line, a semicolon after every member.

Two spaces and not the four the other three renderers use. That is not a preference: TypeScript nests further than Java does for the same IDL — a namespace per module, then an interface, then a member — and the community formatter that every consumer of this output runs would reindent a four-space file on first save, turning every generated file into a diff.

Nothing is decided here. Whether a declaration is exported, whether a property is readonly, whether a name is quoted: all of it is in the tree, and a renderer that chose any of it would put the choice where no rule diff can see it.

Functions§

decl
Render one declaration, for a caller that has only one.
expr
Render one expression, for a caller that has only one.
file
Render a whole file.
type_
Render one type, for a caller that has only one.