Class TsIdentifier
- Namespace
- TypedRest.CodeGeneration.TypeScript.Model
- Assembly
- TypedRest.CodeGeneration.TypeScript.dll
A reference to a TypeScript type.
public sealed class TsIdentifier
- Inheritance
-
objectTsIdentifier
Constructors
TsIdentifier(TsModule?, string, bool)
Creates a new type reference.
public TsIdentifier(TsModule? module, string name, bool nullable = false)
Parameters
moduleTsModuleThe module the type is imported from, or
nullfor built-in types.namestringThe name of the type.
nullableboolIndicates whether the type can have the value
null.
Properties
Any
The built-in any type.
public static TsIdentifier Any { get; }
Property Value
Boolean
The built-in boolean type.
public static TsIdentifier Boolean { get; }
Property Value
IsArray
Indicates whether this is an array of TypeArguments[0] rather than a named generic type.
public bool IsArray { get; }
Property Value
Module
The module the type is imported from, or null for built-in types.
public TsModule? Module { get; }
Property Value
Name
The name of the type.
public string Name { get; }
Property Value
Nullable
Indicates whether the type can have the value null.
public bool Nullable { get; }
Property Value
Number
The built-in number type.
public static TsIdentifier Number { get; }
Property Value
String
The built-in string type.
public static TsIdentifier String { get; }
Property Value
TypeArguments
Generic type arguments for the type.
public List<TsIdentifier> TypeArguments { get; }
Property Value
Unknown
The built-in unknown type.
public static TsIdentifier Unknown { get; }
Property Value
Url
The ambient URL type.
public static TsIdentifier Url { get; }
Property Value
UrlOrString
The URL | string union used for relative URIs.
public static TsIdentifier UrlOrString { get; }
Property Value
Methods
ArrayOf(TsIdentifier)
An array of item.
public static TsIdentifier ArrayOf(TsIdentifier item)
Parameters
itemTsIdentifier
Returns
GetImports()
Returns all imports needed to reference this type.
public IEnumerable<TsImport> GetImports()
Returns
RecordOf(TsIdentifier, TsIdentifier)
A Record mapping key to value.
public static TsIdentifier RecordOf(TsIdentifier key, TsIdentifier value)
Parameters
keyTsIdentifiervalueTsIdentifier
Returns
ToNullable()
Returns a copy of the type reference that can have the value null.
public TsIdentifier ToNullable()
Returns
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.
ToTypeExpression()
Returns the TypeScript expression for this type, e.g. ElementEndpoint<Contact>.
public string ToTypeExpression()