Properties
Methods
checkProgram()
Returns
void
checkSourceFile()
Parameters
Returns
void
cloneType()
Type Parameters
Type Parameter |
---|
T extends Type |
Parameters
Parameter | Type |
---|
type | T |
additionalProps ? | { [P in string | number | symbol]?: T[P] } |
Returns
T
createAndFinishType()
Type Parameters
Parameters
Returns
T
& TypePrototype
createFunctionType()
Parameters
Parameter | Type |
---|
fn | (…args ) => Type |
Returns
FunctionType
createLiteralType()
createLiteralType(value, node)
Parameters
Returns
StringLiteral
createLiteralType(value, node)
Parameters
Returns
NumericLiteral
createLiteralType(value, node)
Parameters
Returns
BooleanLiteral
createLiteralType(value, node)
Parameters
Returns
BooleanLiteral
| NumericLiteral
| StringLiteral
createLiteralType(value, node)
Parameters
Returns
BooleanLiteral
| NumericLiteral
| StringLiteral
createType()
Type Parameters
Parameters
Returns
T
& TypePrototype
& object
evalProjection()
Parameters
Returns
Type
finishType()
Type Parameters
Type Parameter |
---|
T extends Type |
Parameters
Returns
T
getGlobalNamespaceType()
Returns
Namespace
getLiteralType()
getLiteralType(node)
Parameters
Returns
StringLiteral
getLiteralType(node)
Parameters
Returns
NumericLiteral
getLiteralType(node)
Parameters
Returns
BooleanLiteral
getLiteralType(node)
Parameters
Returns
LiteralType
getNamespaceString()
Parameters
Returns
string
Deprecated
use import { getNamespaceFullName } from "@typespec/compiler";
getStdType()
Std type
Type Parameters
Parameters
Parameter | Type | Description |
---|
name | T | Name |
Returns
StdTypes
[T
]
getTypeForNode()
Parameters
Returns
Type
getTypeName()
Parameters
Returns
string
Deprecated
use import { getTypeName } from "@typespec/compiler";
getValueExactType()
Return the exact type of a value.
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)
Check if the given type is one of the built-in standard TypeSpec Types.
Parameters
Returns
type is Scalar & Object
isStdType(type, stdType)
Parameters
Returns
type is Type & Object
isTypeAssignableTo()
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()
Parameters
Returns
Map
<string
, TypeSpecCompletionItem
>
resolveIdentifier()
Parameters
Returns
undefined
| Sym
resolveTypeReference()
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.