How to use the tsUnknownKeyword function from @babel/types

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

20
21
22
23
24
25
26
27
28
29
});

if (schema.additionalProperties) {
  const index =
    schema.additionalProperties === true
      ? t.tsUnknownKeyword()
      : createInterface(schema.additionalProperties);

  const stringKey = t.identifier('key');
  stringKey.typeAnnotation = t.tsTypeAnnotation(t.tsStringKeyword());
fork icon2
star icon14
watch icon2

+ 23 other calls in file

87
88
89
90
91
92
93
94
  } else if (typeof value === 'boolean') {
    return t.tsBooleanKeyword();
  } else if (value === null || value === undefined) {
    return t.tsNullKeyword();
  } else {
    return t.tsUnknownKeyword();
  }
}
fork icon0
star icon1
watch icon0

+ 11 other calls in file

49
50
51
52
53
54
55
56
57
58
    parse(`type X = ${code}`, { plugins: ['typescript'] })
  );
  const { body } = parseResult.program;
  return t.isTSTypeAliasDeclaration(body[0])
    ? body[0].typeAnnotation
    : t.tsUnknownKeyword();
} catch (err) {
  debug(`Failed to parse type string "${code}"`, err);
  return t.tsUnknownKeyword();
}
fork icon0
star icon0
watch icon7

+ 11 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)