/
githubmirror
/
angular
Обзор
Документация
Войти
/
githubmirror
/
angular
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
packages/core/src/render3/node_assert.ts
47 строк
1 KB
Joey Perrott
refactor: update license text to point to angular.dev (#57901)
24 сен 2024, 16:33
24 сен 2024, 16:33
9dbe6fc
Код
Авторство
О чём код?
/** * @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 {assertDefined, throwError} from '../util/assert'; import {TNode, TNodeType, toTNodeTypeAsString} from './interfaces/node'; export function assertTNodeType( tNode: TNode | null, expectedTypes: TNodeType, message?: string, ): void { assertDefined(tNode, 'should be called with a TNode'); if ((tNode.type & expectedTypes) === 0) { throwError( message || `Expected [${toTNodeTypeAsString(expectedTypes)}] but got ${toTNodeTypeAsString( tNode.type, )}.`, ); } } export function assertPureTNodeType(type: TNodeType) { if ( !( type === TNodeType.Element || type === TNodeType.Text || type === TNodeType.Container || type === TNodeType.ElementContainer || type === TNodeType.Icu || type === TNodeType.Projection || type === TNodeType.Placeholder || type === TNodeType.LetDeclaration ) ) { throwError( `Expected TNodeType to have only a single type selected, but got ${toTNodeTypeAsString( type, )}.`, ); } }