/
githubmirror
/
angular
Обзор
Документация
Войти
/
githubmirror
/
angular
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
packages/compiler-cli/test/ngtsc/util.ts
18 строк
637 B
Andrew Kushnir
refactor(compiler-cli): convert scripts within `packages/compiler-cli` to relative imports (#60625)
01 апр 2025, 14:57
01 апр 2025, 14:57
4f458a8
Код
Авторство
О чём код?
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import {ClassDeclaration, isNamedClassDeclaration} from '../../src/ngtsc/reflection'; import ts from 'typescript'; export function getClass(sf: ts.SourceFile, name: string): ClassDeclaration<ts.ClassDeclaration> { for (const stmt of sf.statements) { if (isNamedClassDeclaration(stmt) && stmt.name.text === name) { return stmt; } } throw new Error(`Class ${name} not found in file: ${sf.fileName}: ${sf.text}`); }