Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/tools/lighthouse-audit.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,9 @@ function parseMinScores(raw) {
.map(x => x.split(':'))
.forEach(([key, val]) => (minScores[key] = Number(val) / 100));

if (minScores.hasOwnProperty('all')) {
if (Object.hasOwn(minScores, 'all')) {
AUDIT_CATEGORIES.forEach(
cat => minScores.hasOwnProperty(cat) || (minScores[cat] = minScores.all),
cat => Object.hasOwn(minScores, cat) || (minScores[cat] = minScores.all),
);
delete minScores.all;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export class KeyboardEventManager<T extends KeyboardEvent> extends EventManager<
}

private _normalizeInputs(...args: unknown[]) {
const withModifiers = Array.isArray(args[0]) || Modifier.hasOwnProperty(args[0] as string);
const withModifiers = Array.isArray(args[0]) || Object.hasOwn(Modifier, args[0] as string);
const modifiers = withModifiers ? args[0] : Modifier.None;
const key = withModifiers ? args[1] : args[0];
const handler = withModifiers ? args[2] : args[1];
Expand Down
2 changes: 1 addition & 1 deletion src/bazel-tsconfig-build.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"sourceMap": true,
"inlineSources": true,
"target": "es2022",
"lib": ["es2020", "dom"],
"lib": ["es2022", "dom"],
"types": [],
"skipLibCheck": true,
"paths": {
Expand Down
2 changes: 1 addition & 1 deletion src/cdk/drag-drop/dom/styling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export function extendStyles(
importantProperties?: Set<string>,
) {
for (let key in source) {
if (source.hasOwnProperty(key)) {
if (Object.hasOwn(source, key)) {
const value = source[key];

if (value) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,7 @@ export function createFlexibleConnectedPositionStrategy(

/** Supported locations in the DOM for connected overlays. */
export type FlexibleOverlayPopoverLocation =
| 'global'
| 'inline'
| {type: 'parent'; element: Element};
'global' | 'inline' | {type: 'parent'; element: Element};

/**
* A strategy for positioning overlays. Using this strategy, an overlay is given an
Expand Down Expand Up @@ -1390,7 +1388,7 @@ function extendStyles(
source: CSSStyleDeclaration,
): CSSStyleDeclaration {
for (let key in source) {
if (source.hasOwnProperty(key)) {
if (Object.hasOwn(source, key)) {
destination[key] = source[key];
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/components-examples/example-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class ExampleData {
componentNames!: string[];

constructor(example: string) {
if (!example || !EXAMPLE_COMPONENTS.hasOwnProperty(example)) {
if (!example || !Object.hasOwn(EXAMPLE_COMPONENTS, example)) {
return;
}

Expand Down
2 changes: 1 addition & 1 deletion src/material/tabs/tab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export class MatTab implements OnInit, OnChanges, OnDestroy {
}

ngOnChanges(changes: SimpleChanges<this>): void {
if (changes.hasOwnProperty('textLabel') || changes.hasOwnProperty('disabled')) {
if (Object.hasOwn(changes, 'textLabel') || Object.hasOwn(changes, 'disabled')) {
this._stateChanges.next();
}
}
Expand Down
2 changes: 1 addition & 1 deletion tools/dgeni/common/decorators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {CategorizedClassDoc, DeprecationInfo, HasDecoratorsDoc} from './dgeni-de
import {findJsDocTag, hasJsDocTag} from './tags';

export function isMethod(doc: MemberDoc): boolean {
return doc.hasOwnProperty('parameters') && !doc.isGetAccessor && !doc.isSetAccessor;
return Object.hasOwn(doc, 'parameters') && !doc.isGetAccessor && !doc.isSetAccessor;
}

export function isGenericTypeParameter(doc: MemberDoc): boolean {
Expand Down
2 changes: 1 addition & 1 deletion tools/dgeni/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"compilerOptions": {
"noUnusedParameters": false,
"noUnusedLocals": false,
"lib": ["es2020", "dom"],
"lib": ["es2022", "dom"],
"moduleResolution": "node",
"esModuleInterop": true,
"strictNullChecks": true,
Expand Down
2 changes: 1 addition & 1 deletion tools/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"sourceMap": true,
"declaration": true,
"esModuleInterop": true,
"lib": ["es2020"],
"lib": ["es2022"],
"skipLibCheck": true,
"types": ["node"]
},
Expand Down
2 changes: 1 addition & 1 deletion tools/tslint-rules/lifecycleHookInterfaceRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class Walker extends Lint.RuleWalker {
if (
!ts.isMethodDeclaration(member) ||
!ts.isIdentifier(member.name) ||
!HOOKS_TO_INTERFACES.hasOwnProperty(member.name.text)
!Object.hasOwn(HOOKS_TO_INTERFACES, member.name.text)
) {
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"skipLibCheck": true,
"strictBindCallApply": true,
"target": "es2022",
"lib": ["es2020", "dom"],
"lib": ["es2022", "dom"],
"types": ["jasmine"],
"paths": {
"@angular/aria": ["./src/aria"],
Expand Down
1 change: 1 addition & 0 deletions tslint.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
{"name": ["*", "removeChild"], "message": "Use `remove` instead instead."},
{"name": ["CommonModule"], "message": "Import the necessary symbols directly instead."},
{"name": ["*", "compileComponents"], "message": "`compileComponents` is not necessary."},
{"name": ["*", "hasOwnProperty"], "message": "Use `Object.hasOwn` instead."},
{
"name": ["isDevMode"],
"message": "Use `typeof ngDevMode === 'undefined' || ngDevMode` instead"
Expand Down
Loading