[I] Checker
Methods
Section titled “Methods”cloneType()
Section titled “cloneType()”cloneType<T>(type, additionalProps?): T;
Type Parameters
Section titled “Type Parameters”Type Parameter |
---|
T extends Type |
Parameters
Section titled “Parameters”Parameter | Type |
---|---|
type | T |
additionalProps? | { [P in string | number | symbol]?: T[P] } |
Returns
Section titled “Returns”T
createAndFinishType()
Section titled “createAndFinishType()”createAndFinishType<T>(typeDef): T & TypePrototype;
Type Parameters
Section titled “Type Parameters”Type Parameter |
---|
T extends CreateTypeProps |
Parameters
Section titled “Parameters”Parameter | Type |
---|---|
typeDef | T |
Returns
Section titled “Returns”T
& TypePrototype
createLiteralType()
Section titled “createLiteralType()”Call Signature
Section titled “Call Signature”createLiteralType(value, node?): StringLiteral;
Parameters
Section titled “Parameters”Parameter | Type |
---|---|
value | string |
node? | StringLiteralNode |
Returns
Section titled “Returns”Call Signature
Section titled “Call Signature”createLiteralType(value, node?): NumericLiteral;
Parameters
Section titled “Parameters”Parameter | Type |
---|---|
value | number |
node? | NumericLiteralNode |
Returns
Section titled “Returns”Call Signature
Section titled “Call Signature”createLiteralType(value, node?): BooleanLiteral;
Parameters
Section titled “Parameters”Parameter | Type |
---|---|
value | boolean |
node? | BooleanLiteralNode |
Returns
Section titled “Returns”Call Signature
Section titled “Call Signature”createLiteralType(value, node?): | BooleanLiteral | NumericLiteral | StringLiteral;
Parameters
Section titled “Parameters”Parameter | Type |
---|---|
value | string | number | boolean |
node? | StringLiteralNode | NumericLiteralNode | BooleanLiteralNode |
Returns
Section titled “Returns”| BooleanLiteral
| NumericLiteral
| StringLiteral
Call Signature
Section titled “Call Signature”createLiteralType(value, node?): | BooleanLiteral | NumericLiteral | StringLiteral;
Parameters
Section titled “Parameters”Parameter | Type |
---|---|
value | string | number | boolean |
node? | StringLiteralNode | NumericLiteralNode | BooleanLiteralNode |
Returns
Section titled “Returns”| BooleanLiteral
| NumericLiteral
| StringLiteral
createType()
Section titled “createType()”createType<T>(typeDef): T & TypePrototype & object;
Type Parameters
Section titled “Type Parameters”Type Parameter |
---|
T extends CreateTypeProps |
Parameters
Section titled “Parameters”Parameter | Type |
---|---|
typeDef | T |
Returns
Section titled “Returns”T
& TypePrototype
& object
finishType()
Section titled “finishType()”finishType<T>(typeDef): T;
Type Parameters
Section titled “Type Parameters”Type Parameter |
---|
T extends Type |
Parameters
Section titled “Parameters”Parameter | Type |
---|---|
typeDef | T |
Returns
Section titled “Returns”T
getStdType()
Section titled “getStdType()”getStdType<T>(name): StdTypes[T];
Std type
Type Parameters
Section titled “Type Parameters”Type Parameter |
---|
T extends | "Array" | IntrinsicScalarName | "Record" |
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
name | T | Name |
Returns
Section titled “Returns”StdTypes
[T
]
getTypeForNode()
Section titled “getTypeForNode()”getTypeForNode(node): Type;
Using this API involves working with the TypeSpec Ast and may change at any time. See https://typespec.io/docs/handbook/breaking-change-policy/
Parameters
Section titled “Parameters”Parameter | Type |
---|---|
node | Node |
Returns
Section titled “Returns”getValueExactType()
Section titled “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
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
value | Value |
Returns
Section titled “Returns”undefined
| Type
isStdType()
Section titled “isStdType()”Call Signature
Section titled “Call Signature”isStdType(type, stdType?): type is Scalar & { name: IntrinsicScalarName };
Check if the given type is one of the built-in standard TypeSpec Types.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
type | Scalar | Type to check |
stdType? | IntrinsicScalarName | If provided check is that standard type |
Returns
Section titled “Returns”type is Scalar & { name: IntrinsicScalarName }
Call Signature
Section titled “Call Signature”isStdType(type, stdType?): type is Type & { name: "Array" | IntrinsicScalarName | "Record" };
Parameters
Section titled “Parameters”Parameter | Type |
---|---|
type | Type |
stdType? | | "Array" | IntrinsicScalarName | "Record" |
Returns
Section titled “Returns”type is Type & { name: “Array” | IntrinsicScalarName | “Record” }