ts-morph#VariableDeclaration TypeScript Examples

The following examples show how to use ts-morph#VariableDeclaration. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: index.ts    From tarojs-router-next with MIT License 6 votes vote down vote up
export function extractValue(options: { name: string; declaration: VariableDeclaration; checker: TypeChecker }) {
  const { name, declaration, checker } = options

  if (!VariableDeclaration.is(declaration.getKind())) throw Error(`${name} 应该导出变量类型`)

  const text = declaration.getFullText()

  return text.split('=', 2)[1].trim()
}