Create getter methods `getXXXDef` for each definition which uses `hasOwnProperty` to verify that we don't accidently read form the parent class. Fixes: #24011 Fixes: #25026 PR Close #25736
		
			
				
	
	
		
			31 lines
		
	
	
		
			1004 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			31 lines
		
	
	
		
			1004 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| /**
 | |
|  * @license
 | |
|  * Copyright Google Inc. 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.io/license
 | |
|  */
 | |
| 
 | |
| export function getClosureSafeProperty<T>(objWithPropertyToExtract: T): string {
 | |
|   for (let key in objWithPropertyToExtract) {
 | |
|     if (objWithPropertyToExtract[key] === getClosureSafeProperty as any) {
 | |
|       return key;
 | |
|     }
 | |
|   }
 | |
|   throw Error('Could not find renamed property on target object.');
 | |
| }
 | |
| 
 | |
| /**
 | |
|  * Sets properties on a target object from a source object, but only if
 | |
|  * the property doesn't already exist on the target object.
 | |
|  * @param target The target to set properties on
 | |
|  * @param source The source of the property keys and values to set
 | |
|  */
 | |
| export function fillProperties(target: {[key: string]: string}, source: {[key: string]: string}) {
 | |
|   for (const key in source) {
 | |
|     if (source.hasOwnProperty(key) && !target.hasOwnProperty(key)) {
 | |
|       target[key] = source[key];
 | |
|     }
 | |
|   }
 | |
| }
 |