How to use the tsLiteralType function from @babel/types
Find comprehensive JavaScript @babel/types.tsLiteralType code examples handpicked from public code repositorys.
36 37 38 39 40 41 42 43 44 45
return t.tsTypeLiteral(properties); }, string(schema) { if (schema.enum) { return t.tsUnionType( schema.enum.map((variant) => t.tsLiteralType(t.stringLiteral(variant))), ); } return t.tsStringKeyword(); // add enum
2
14
2
+ 23 other calls in file
GitHub: dfreeman/declgen
70 71 72 73 74 75 76 77 78 79
return t.tsTypeLiteral( Object.keys(value).map(key => { let propertyValue = value[key]; let propertyValueType = path.length === 0 && key === 'environment' ? t.tsLiteralType(t.stringLiteral(propertyValue)) : typeFor(path.concat(key), propertyValue); return t.tsPropertySignature(t.identifier(key), t.tsTypeAnnotation(propertyValueType)); })
0
1
0
+ 11 other calls in file
@babel/types.identifier is the most popular function in @babel/types (20936 examples)