简体   繁体   中英

Interface Property name named from myStrings

I typed up a bunch of strings for a project:

declare interface IMyWebPartStrings {
  PropertyDamage: string;
  EventWorkRelated: string;
  EmployeeWearingProperPPE: string;
  YourSupervisor: string;
  Region: string;
  Branch: string;
  PositionTitle: string;
  LocationOfEvent: string;
  DateOfIncident: string;
  InvolvedPeople: string;
  EventDetails: string;
  CorrectiveActions: string;
  CorrectiveActionsDetails: string;
  ...
}

I am creating an interface and it will have all the same names.

When I create the interface , is there a way I can name the properties from the myStrings list?

No, that is not possible.

Quick explanation: Interfaces are defined before compilation of the code, but the contents of the myStrings list is only known after, when the code is run (even when you hard-code the value of myStrings, this won't get interpreted until the code is run).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM