How to use the doctrine/lib/typed.js.parseType function in doctrine

To help you get started, we’ve selected a few doctrine examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Polymer / tools / packages / gen-typescript-declarations / src / closure-types.ts View on Github external
export function closureTypeToTypeScript(
    closureType: string|null|undefined, templateTypes: string[] = []): ts.Type {
  if (!closureType) {
    return ts.anyType;
  }
  let ast;
  try {
    ast = parseType(closureType);
  } catch {
    return ts.anyType;
  }
  return convert(ast, templateTypes);
}