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(
+ 23 other calls in file
GitHub: openapi/preset-effector
![openapi profile picture](/openapi.png?size=40)
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))), ),
+ 23 other calls in file
GitHub: johanholmerin/tscm
![johanholmerin profile picture](/johanholmerin.png?size=40)
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()) )
+ 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),
+ 7 other calls in file
GitHub: dfreeman/declgen
![dfreeman profile picture](/dfreeman.png?size=40)
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'
+ 11 other calls in file
@babel/types.identifier is the most popular function in @babel/types (20936 examples)