Skip to content
This repository has been archived by the owner on Aug 28, 2023. It is now read-only.

Commit

Permalink
Explicitly make all ViewChildren static
Browse files Browse the repository at this point in the history
See: angular/angular-cli#14553 (comment)

Fixes build error "TS2554: Expected 2 arguments, but got 1."
  • Loading branch information
flibbertigibbet authored and maurizi committed Jul 12, 2019
1 parent 0b07f7e commit 38d673b
Show file tree
Hide file tree
Showing 20 changed files with 38 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
templateUrl: './action-card-container.component.html'
})
export class ActionCardContainerComponent implements OnInit {
@ViewChild('confirmDeleteModal') confirmDeleteModal: ConfirmationModalComponent;
@ViewChild('confirmDeleteModal', {static: true}) confirmDeleteModal: ConfirmationModalComponent;

@Input() public risks: Risk[];
@Output() public risksChange = new EventEmitter<Risk[]>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { ModalTemplateComponent } from '../shared/modal-template/modal-template.
})

export class ActionStepsOverviewComponent implements OnInit {
@ViewChild('reviewYourPlanModal') reviewYourPlanModal: ModalTemplateComponent;
@ViewChild('reviewYourPlanModal', {static: true}) reviewYourPlanModal: ModalTemplateComponent;

public risks: Risk[];
public allRisks: Risk[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ interface NamedRisk {
})
export class ActionWizardComponent implements AfterViewInit, OnInit {

@ViewChild(WizardComponent) public wizard: WizardComponent;
@ViewChild(AssessStepComponent) public assessStep: AssessStepComponent;
@ViewChild(ImplementationStepComponent) public implementationStep: ImplementationStepComponent;
@ViewChild(ImprovementsStepComponent) public improvementsStep: ImprovementsStepComponent;
@ViewChild(CategoryStepComponent) public categoryStep: CategoryStepComponent;
@ViewChild(FundingStepComponent) public fundingStep: FundingStepComponent;
@ViewChild(ReviewStepComponent) public reviewStep: ReviewStepComponent;
@ViewChild(WizardComponent, {static: true}) public wizard: WizardComponent;
@ViewChild(AssessStepComponent, {static: true}) public assessStep: AssessStepComponent;
@ViewChild(ImplementationStepComponent, {static: true}) public implementationStep: ImplementationStepComponent;
@ViewChild(ImprovementsStepComponent, {static: true}) public improvementsStep: ImprovementsStepComponent;
@ViewChild(CategoryStepComponent, {static: true}) public categoryStep: CategoryStepComponent;
@ViewChild(FundingStepComponent, {static: true}) public fundingStep: FundingStepComponent;
@ViewChild(ReviewStepComponent, {static: true}) public reviewStep: ReviewStepComponent;

@Input() action: Action;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
})
export class AssessmentOverviewTableComponent implements OnInit {

@ViewChild('confirmDeleteModal') confirmDeleteModal: ConfirmationModalComponent;
@ViewChild('confirmDeleteModal', {static: true}) confirmDeleteModal: ConfirmationModalComponent;
@Input() risks: Risk[];
@Output() risksChange = new EventEmitter<Risk[]>();
@Input() showFullTitle = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ export class RiskPopoverComponent implements OnInit {
public selectedIndicator: Indicator;
public location: Location;

@ViewChild('indicatorModal')
@ViewChild('indicatorModal', {static: true})
private indicatorModal: ModalTemplateComponent;

@ViewChild('popover')
@ViewChild('popover', {static: true})
private popoverElement: PopoverDirective;

constructor (private indicatorService: IndicatorService,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ import { HazardsStepComponent } from './steps/hazards-step/hazards-step.componen
export class PlanWizardComponent implements OnInit {
// this.wizard.navigation and this.wizard.model are not available until after AfterViewInit

@ViewChild(WizardComponent) public wizard: WizardComponent;
@ViewChild(CommunitySystemsStepComponent) public communitySystemsStep:
@ViewChild(WizardComponent, {static: true}) public wizard: WizardComponent;
@ViewChild(CommunitySystemsStepComponent, {static: true}) public communitySystemsStep:
CommunitySystemsStepComponent;
@ViewChild(DueDateStepComponent) public dueDateStep: DueDateStepComponent;
@ViewChild(HazardsStepComponent) public hazardsStep: HazardsStepComponent;
@ViewChild(DueDateStepComponent, {static: true}) public dueDateStep: DueDateStepComponent;
@ViewChild(HazardsStepComponent, {static: true}) public hazardsStep: HazardsStepComponent;

@Input() organization: Organization;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export class DashboardComponent implements OnInit {

private weatherEvents: WeatherEvent[];

@ViewChild('trialWarningModal') private trialWarningModal: ModalTemplateComponent;
@ViewChild('trialWarningModal', {static: true}) private trialWarningModal: ModalTemplateComponent;

constructor(private cache: CacheService,
private organizationService: OrganizationService,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ interface AggregateNeed {

export class GroupedRiskComponent implements OnChanges, OnInit {

@ViewChild('indicatorChartModal')
@ViewChild('indicatorChartModal', {static: true})
private indicatorsModal: ModalTemplateComponent;

@Input() risks: Risk[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { OrgSubscription, OrgSubscriptionOptions, OrgSubscriptionPlan, User } fr
templateUrl: './expiration-modal.component.html'
})
export class ExpirationModalComponent implements OnInit {
@ViewChild('expirationModal') expirationModal: ModalDirective;
@ViewChild('expirationModal', {static: true}) expirationModal: ModalDirective;
public downloadDisabled = false;
public isModalShown = true;
private user: User;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ enum SubscriptionModalStep {
})
export class ManageSubscriptionComponent implements OnInit {

@ViewChild('selectSubscriptionModal') subscriptionModal: ModalTemplateComponent;
@ViewChild('selectSubscriptionModal', {static: true}) subscriptionModal: ModalTemplateComponent;

public activeModalStep = SubscriptionModalStep.Select;
public customPlan = OrgSubscriptionOptions.get(OrgSubscription.Custom);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ import { InviteStepComponent } from './steps/invite-step/invite-step.component';
})
export class OrganizationWizardComponent implements OnInit {

@ViewChild(WizardComponent) public wizard: WizardComponent;
@ViewChild(CityStepComponent) public identifyStep: CityStepComponent;
@ViewChild(InviteStepComponent) public inviteStep: InviteStepComponent;
@ViewChild(WizardComponent, {static: true}) public wizard: WizardComponent;
@ViewChild(CityStepComponent, {static: true}) public identifyStep: CityStepComponent;
@ViewChild(InviteStepComponent, {static: true}) public inviteStep: InviteStepComponent;

public form: FormGroup;
public user: User;
Expand Down
12 changes: 6 additions & 6 deletions src/angular/planit/src/app/risk-wizard/risk-wizard.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ import { ReviewStepComponent } from './steps/review-step/review-step.component';
export class RiskWizardComponent implements OnInit, AfterViewChecked {
// this.wizard.navigation and this.wizard.model are not available until after AfterViewInit

@ViewChild(WizardComponent) public wizard: WizardComponent;
@ViewChild(IdentifyStepComponent) public identifyStep: IdentifyStepComponent;
@ViewChild(HazardStepComponent) public hazardStep: HazardStepComponent;
@ViewChild(ImpactStepComponent) public impactStep: ImpactStepComponent;
@ViewChild(CapacityStepComponent) public capacityStep: CapacityStepComponent;
@ViewChild(ReviewStepComponent) public reviewStep: ReviewStepComponent;
@ViewChild(WizardComponent, {static: true}) public wizard: WizardComponent;
@ViewChild(IdentifyStepComponent, {static: true}) public identifyStep: IdentifyStepComponent;
@ViewChild(HazardStepComponent, {static: true}) public hazardStep: HazardStepComponent;
@ViewChild(ImpactStepComponent, {static: true}) public impactStep: ImpactStepComponent;
@ViewChild(CapacityStepComponent, {static: true}) public capacityStep: CapacityStepComponent;
@ViewChild(ReviewStepComponent, {static: true}) public reviewStep: ReviewStepComponent;

@Input() risk: Risk;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export class HazardStepComponent extends RiskWizardStepComponent<HazardStepFormM
public directionalIntensityOptionsKeys = Array.from(OrgRiskDirectionalIntensityOptions.keys());
public indicators: Indicator[] = [];

@ViewChild('indicatorChartModal')
@ViewChild('indicatorChartModal', {static: true})
private indicatorsModal: ModalTemplateComponent;

private sessionSubscription: Subscription;
Expand Down
4 changes: 2 additions & 2 deletions src/angular/planit/src/app/settings/settings.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import { EditableInputComponent } from './editable-input/editable-input.componen
})
export class SettingsComponent implements OnInit {

@ViewChildren(EditableInputComponent) inputs: QueryList<EditableInputComponent>;
@ViewChild('confirmRemoveModal') confirmDeleteModal: ConfirmationModalComponent;
@ViewChildren(EditableInputComponent, {static: true}) inputs: QueryList<EditableInputComponent>;
@ViewChild('confirmRemoveModal', {static: true}) confirmDeleteModal: ConfirmationModalComponent;

public form: FormGroup;
public minDate: Date = new Date();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export interface ConfirmModalConfig {
})
export class ConfirmationModalComponent implements OnDestroy {

@ViewChild('modal') modal: ModalTemplateComponent;
@ViewChild('modal', {static: true}) modal: ModalTemplateComponent;

public cancelText: string;
public confirmButtonClass: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class FreeformMultiselectComponent implements ControlValueAccessor, OnCha

@Input() public options: string[] = [];
@Input() public inputId: string = null;
@ViewChild('typeahead') typeahead;
@ViewChild('typeahead', {static: true}) typeahead;

public selected = '';
public unsaved = '';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export class IndicatorChartComponent implements OnInit, DoCheck {
public temperatureUnits = TemperatureUnits;
public precipitationUnits = PrecipitationUnits;

@ViewChild(ModelModalComponent)
@ViewChild(ModelModalComponent, {static: true})
private modelModal: ModelModalComponent;
private el: ElementRef;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export class ModalTemplateComponent {

public modalRef: BsModalRef;

@ViewChild(TemplateRef)
@ViewChild(TemplateRef, {static: true})
private modal: TemplateRef<any>;

private defaults: ModalOptions = {animated: false, class: 'modal-lg'};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
})

export class OrgDropdownComponent implements OnDestroy, OnInit {
@ViewChild('confirmOrgChangeModal') confirmOrgChangeModal: ConfirmationModalComponent;
@ViewChild('confirmOrgChangeModal', {static: true}) confirmOrgChangeModal: ConfirmationModalComponent;

private dropdownUser: User;
private dropdownPrimaryOrganization: Organization;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { ConfirmationModalComponent } from '../confirmation-modal/confirmation-m
})
export class SubmitPlanButtonComponent {

@ViewChild('confirmSubmitModal') confirmSubmitModal: ConfirmationModalComponent;
@ViewChild('confirmSubmitModal', {static: true}) confirmSubmitModal: ConfirmationModalComponent;

constructor(private toastr: ToastrService,
private planService: PlanService) { }
Expand Down

0 comments on commit 38d673b

Please sign in to comment.