1. Ts declares a mandatory property
id! :number;
Copy the code
  1. Enumeration types are used in TS declarations
export enum RuleType {
  Keyword = 'KEYWORD',
  Quality = 'QUALITY',}export enum RuleGroup {
  System = 'SYSTEM',
  Customize = 'CUSTOMIZE',
  Exclude = 'EXCLUDE',}export interface Rule {
  ruleType: RuleType;
  ruleGroup: RuleGroup;
}

/ / when used
 const mockRuleList = [{
    ruleType: RuleType.Quality,
    ruleGroup: RuleGroup.Exclude,
  }]
Copy the code