Properties
Methods
checkProgram()
Returns
void
checkSourceFile()
checkSourceFile(file): void
Parameters
Returns
void
cloneType()
cloneType<T>(type, additionalProps?): T
Type Parameters
Type Parameter |
---|
T extends Type |
Parameters
Parameter | Type |
---|
type | T |
additionalProps ? | { [P in string | number | symbol]?: T[P] } |
Returns
T
createAndFinishType()
createAndFinishType<T>(typeDef): T & TypePrototype
Type Parameters
Parameters
Returns
T
& TypePrototype
createFunctionType()
createFunctionType(fn): FunctionType
Parameters
Parameter | Type |
---|
fn | (…args ) => Type |
Returns
FunctionType
createLiteralType()
createLiteralType(value, node)
createLiteralType(value, node?): StringLiteral
Parameters
Returns
StringLiteral
createLiteralType(value, node)
createLiteralType(value, node?): NumericLiteral
Parameters
Returns
NumericLiteral
createLiteralType(value, node)
createLiteralType(value, node?): BooleanLiteral
Parameters
Returns
BooleanLiteral
createLiteralType(value, node)
createLiteralType(value, node?): BooleanLiteral | NumericLiteral | StringLiteral
Parameters
Returns
BooleanLiteral
| NumericLiteral
| StringLiteral
createLiteralType(value, node)
createLiteralType(value, node?): BooleanLiteral | NumericLiteral | StringLiteral
Parameters
Returns
BooleanLiteral
| NumericLiteral
| StringLiteral
createType()
createType<T>(typeDef): T & TypePrototype & object
Type Parameters
Parameters
Returns
T
& TypePrototype
& object
evalProjection()
Parameters
Returns
Type
finishType()
finishType<T>(typeDef): T
Type Parameters
Type Parameter |
---|
T extends Type |
Parameters
Returns
T
getGlobalNamespaceType()
getGlobalNamespaceType(): Namespace
Returns
Namespace
getLiteralType()
getLiteralType(node)
getLiteralType(node): StringLiteral
Parameters
Returns
StringLiteral
getLiteralType(node)
getLiteralType(node): NumericLiteral
Parameters
Returns
NumericLiteral
getLiteralType(node)
getLiteralType(node): BooleanLiteral
Parameters
Returns
BooleanLiteral
getLiteralType(node)
getLiteralType(node): LiteralType
Parameters
Returns
LiteralType
getNamespaceString()
getNamespaceString(type, options?): string
Parameters
Returns
string
Deprecated
use import { getNamespaceFullName } from "@typespec/compiler";
getStdType()
getStdType<T>(name): StdTypes[T]
Std type
Type Parameters
Parameters
Parameter | Type | Description |
---|
name | T | Name |
Returns
StdTypes
[T
]
getTypeForNode()
getTypeForNode(node): Type
Parameters
Returns
Type
getTypeName()
getTypeName(type, options?): string
Parameters
Returns
string
Deprecated
use import { getTypeName } from "@typespec/compiler";
getValueExactType()
getValueExactType(value): undefined | Type
Return the exact type of a value.
const a: string = "hello";
calling getValueExactType
on the value of a would give the string literal “hello”.
Parameters
Parameter | Type | Description |
---|
value | Value | |
Returns
undefined
| Type
isStdType()
isStdType(type, stdType)
isStdType(type, stdType?): type is Scalar & Object
Check if the given type is one of the built-in standard TypeSpec Types.
Parameters
Returns
type is Scalar & Object
isStdType(type, stdType)
isStdType(type, stdType?): type is Type & Object
Parameters
Returns
type is Type & Object
isTypeAssignableTo()
diagnosticTarget): [boolean, readonly Diagnostic[]]
Check if the source type can be assigned to the target type.
Parameters
Parameter | Type | Description |
---|
source | Entity | Source type, should be assignable to the target. |
target | Entity | Target type |
diagnosticTarget | DiagnosticTarget | Target for the diagnostic, unless something better can be inferred. |
Returns
[boolean
, readonly Diagnostic
[]]
[related, list of diagnostics]
project()
Parameters
Returns
Type
resolveCompletions()
resolveCompletions(node): Map<string, TypeSpecCompletionItem>
Parameters
Returns
Map
<string
, TypeSpecCompletionItem
>
resolveIdentifier()
resolveIdentifier(node): undefined | Sym
Parameters
Returns
undefined
| Sym
resolveTypeReference()
resolveTypeReference(node): [undefined | Type, readonly Diagnostic[]]
Check and resolve a type for the given type reference node.
Parameters
Returns
[undefined
| Type
, readonly Diagnostic
[]]
Resolved type and diagnostics if there was an error.