How to use the tsTypeLiteral function from @babel/types
Find comprehensive JavaScript @babel/types.tsTypeLiteral code examples handpicked from public code repositorys.
31 32 33 34 35 36 37 38 39 40
properties.push( t.tsIndexSignature([stringKey], t.tsTypeAnnotation(index)), ); } return t.tsTypeLiteral(properties); }, string(schema) { if (schema.enum) { return t.tsUnionType(
2
14
2
+ 23 other calls in file
GitHub: openapi/preset-effector
33 34 35 36 37 38 39 40 41 42
function createTypeDoneVariant({ status, contractName }) { /** * status: 'ok'; * answer: typed.Get<typeof registerRequestOk>; */ return t.tsTypeLiteral([ t.tsPropertySignature( t.identifier('status'), t.tsTypeAnnotation(t.tsLiteralType(t.stringLiteral(status))), ),
2
14
2
+ 23 other calls in file
GitHub: johanholmerin/tscm
7 8 9 10 11 12 13 14 15 16
[t.arrayExpression()] ), { typeParameters: t.tsTypeParameterInstantiation([ t.tsArrayType( t.tsTypeLiteral([ t.tsPropertySignature( t.identifier('id'), t.tsTypeAnnotation(t.tsStringKeyword()) )
0
31
2
+ 5 other calls in file
16 17 18 19 20 21 22 23 24 25
return t.objectProperty(t.stringLiteral(key), t.identifier(key === name ? key : name)) })) if (hasTsType) { objectPattern.typeAnnotation = t.tsTypeAnnotation( t.tsTypeLiteral( params.map((param, index) => { const key = index ? (index === 1 ? 'record' : 'index') : 'text' return t.tsPropertySignature( t.identifier(key),
0
5
2
+ 7 other calls in file
GitHub: dfreeman/declgen
65 66 67 68 69 70 71 72 73 74
} } function typeFor(path, value) { if (typeof value === 'object' && !!value) { return t.tsTypeLiteral( Object.keys(value).map(key => { let propertyValue = value[key]; let propertyValueType = path.length === 0 && key === 'environment'
0
1
0
+ 11 other calls in file
@babel/types.identifier is the most popular function in @babel/types (20936 examples)