How to use the variance function from @babel/types

Find comprehensive JavaScript @babel/types.variance code examples handpicked from public code repositorys.

139
140
141
142
143
144
145
146
147
148
/**
 * +KEY: VALUE
 */
function readOnlyObjectTypeProperty(key: string, value: BabelAST): $FlowFixMe {
  const prop = t.objectTypeProperty(t.identifier(key), value);
  prop.variance = t.variance('plus');
  return prop;
}

function stringLiteralTypeAnnotation(value: string): $FlowFixMe {
fork icon0
star icon1
watch icon3

+ 3 other calls in file

Other functions in @babel/types

Sorted by popularity

function icon

@babel/types.identifier is the most popular function in @babel/types (20936 examples)