angular/devtools/src/app/demo-app/sample-properties.component.ts
Milo 1de7ab28b4 fix(devtools): fix some build errors from g3 typescript (#62412)
this avoids some issues with casting types

PR Close #62412
2025-07-11 10:35:22 -07:00

52 lines
1.5 KiB
TypeScript

/**
* @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 {Component, computed, ElementRef, inject, signal, viewChild} from '@angular/core';
import {SIGNAL} from '@angular/core/primitives/signals';
import {SampleService} from './sample.service';
@Component({
selector: 'app-sample-properties',
template: '',
styles: [''],
})
export class SamplePropertiesComponent {
readonly elementRef = viewChild<ElementRef>('elementReference');
exampleService = inject(SampleService);
exampleBoolean = true;
exampleString = 'John';
exampleSymbol = Symbol.iterator;
exampleNumber = 40;
exampleBigint = BigInt(40);
exampleUndefined = undefined;
exampleNull = null;
exampleObject = {name: 'John', age: 40};
exampleArray = [1, 2, [3, 4], {name: 'John', age: 40, skills: ['JavaScript']}];
exampleSet = new Set([1, 2, 3, 4, 5]);
exampleMap = new Map<unknown, unknown>([
['name', 'John'],
['age', 40],
[{id: 123}, undefined],
]);
exampleDate = new Date();
exampleFunction = () => 'John';
signalPrimitive = signal(123);
computedPrimitive = computed(() => this.signalPrimitive() ** 2);
signalObject = signal({name: 'John', age: 40});
computedObject = computed(() => {
const original = this.signalObject();
return {...original, age: original.age + 1};
});
signalSymbol = SIGNAL;
}