Function typescript_type_def::write_definition_file[][src]

pub fn write_definition_file<W, T: ?Sized>(
    writer: W,
    options: DefinitionFileOptions<'_>
) -> Result<Stats> where
    W: Write,
    T: TypeDef
Expand description

Writes a TypeScript definition file containing type definitions for T to the writer W.

The resulting TypeScript module will define and export the type definition for T and all of its transitive dependencies under a namespace called types (each type definition may have its own nested namespace under types as well). The namespace types will also be the default export of the module.

The file will also include a header comment indicating that it was auto-generated by this library.

Note that the TypeScript code produced by this library is not in a human-readable format. To make the code human-readable, use a TypeScript code formatter, such as Prettier, on the file.