Struct typescript_type_def::DefinitionFileOptions [−][src]
Expand description
Options for customizing the output of write_definition_file
.
The default options are:
DefinitionFileOptions {
header: Some("// AUTO-GENERATED by typescript-type-def\n"),
root_namespace: "types",
}
Fields
header: Option<&'a str>
Text to be emitted at the start of the file.
If Some
, the string should contain the exact content of the header as
TypeScript code (usually in the form of comments). If None
, no header
will be added.
root_namespace: &'a str
The name of the root namespace which the definitions will be placed under.
The reason all definitions must be placed under a root namespace is to prevent name ambiguities. Consider the following TypeScript module:
type Foo = number;
export namespace foo {
type Foo = string;
type Bar = { x: Foo };
}
In this case, the type that Bar.x
refers to is ambiguous; it could be
either the top-level Foo
or the adjacent Foo
. Placing all types
under a namespace and referencing them by full path removes this
ambiguity:
export namespace root {
type Foo = number;
export namespace foo {
type Foo = string;
type Bar = { x: root.Foo };
}
}
Trait Implementations
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
Auto Trait Implementations
impl<'a> RefUnwindSafe for DefinitionFileOptions<'a>
impl<'a> Send for DefinitionFileOptions<'a>
impl<'a> Sync for DefinitionFileOptions<'a>
impl<'a> Unpin for DefinitionFileOptions<'a>
impl<'a> UnwindSafe for DefinitionFileOptions<'a>
Blanket Implementations
Mutably borrows from an owned value. Read more