fix: argument destructuring sometimes breaks strictNullChecks

Destructuring of the form:

function foo({a, b}: {a?, b?} = {})

breaks strictNullChecks, due to the TypeScript bug https://github.com/microsoft/typescript/issues/10078.
This change eliminates usage of destructuring in function argument lists in cases where it would leak
into the public API .d.ts.
This commit is contained in:
Alex Rickabaugh
2017-06-12 10:59:29 -07:00
committed by Hans
parent 009651e14f
commit c59c390cdc
8 changed files with 91 additions and 97 deletions

View File

@ -183,11 +183,8 @@ export interface ContentChildrenDecorator {
* @stable
* @Annotation
*/
(selector: Type<any>|Function|string,
{descendants, read}?: {descendants?: boolean, read?: any}): any;
new (
selector: Type<any>|Function|string,
{descendants, read}?: {descendants?: boolean, read?: any}): Query;
(selector: Type<any>|Function|string, opts?: {descendants?: boolean, read?: any}): any;
new (selector: Type<any>|Function|string, opts?: {descendants?: boolean, read?: any}): Query;
}
/**
@ -247,8 +244,8 @@ export interface ContentChildDecorator {
* @stable
* @Annotation
*/
(selector: Type<any>|Function|string, {read}?: {read?: any}): any;
new (selector: Type<any>|Function|string, {read}?: {read?: any}): ContentChild;
(selector: Type<any>|Function|string, opts?: {read?: any}): any;
new (selector: Type<any>|Function|string, opts?: {read?: any}): ContentChild;
}
/**
@ -308,8 +305,8 @@ export interface ViewChildrenDecorator {
* @stable
* @Annotation
*/
(selector: Type<any>|Function|string, {read}?: {read?: any}): any;
new (selector: Type<any>|Function|string, {read}?: {read?: any}): ViewChildren;
(selector: Type<any>|Function|string, opts?: {read?: any}): any;
new (selector: Type<any>|Function|string, opts?: {read?: any}): ViewChildren;
}
/**
@ -365,8 +362,8 @@ export interface ViewChildDecorator {
* @stable
* @Annotation
*/
(selector: Type<any>|Function|string, {read}?: {read?: any}): any;
new (selector: Type<any>|Function|string, {read}?: {read?: any}): ViewChild;
(selector: Type<any>|Function|string, opts?: {read?: any}): any;
new (selector: Type<any>|Function|string, opts?: {read?: any}): ViewChild;
}
/**

View File

@ -76,22 +76,21 @@ export class ViewMetadata {
/** {@link Component#interpolation} */
interpolation: [string, string]|undefined;
constructor(
{templateUrl, template, encapsulation, styles, styleUrls, animations, interpolation}: {
templateUrl?: string,
template?: string,
encapsulation?: ViewEncapsulation,
styles?: string[],
styleUrls?: string[],
animations?: any[],
interpolation?: [string, string]
} = {}) {
this.templateUrl = templateUrl;
this.template = template;
this.styleUrls = styleUrls;
this.styles = styles;
this.encapsulation = encapsulation;
this.animations = animations;
this.interpolation = interpolation;
constructor(opts: {
templateUrl?: string,
template?: string,
encapsulation?: ViewEncapsulation,
styles?: string[],
styleUrls?: string[],
animations?: any[],
interpolation?: [string, string]
} = {}) {
this.templateUrl = opts.templateUrl;
this.template = opts.template;
this.styleUrls = opts.styleUrls;
this.styles = opts.styles;
this.encapsulation = opts.encapsulation;
this.animations = opts.animations;
this.interpolation = opts.interpolation;
}
}