Skip to content

TypeSpec supports all reserved keywords as model property keys. #11136

Description

@imteammy

Clear and concise description of the problem

model Test {
  // import:string;
  // model:string;
  // scalar:string;
  // enum:string;
  // union:string;
  // interface:string;
  // op:string;
  // namespace:string;
  // using:string;
  // is:string;
  // extends:string;
  // alias:string;
  // const:string;
  // etc...
}

current solution: provides an escaping mechanism using backticks (`) or bouble quote (").

model Test {
  "import" :string;
  "model" :string;
  "scalar" :string;
  "enum" :string;
  "union" :string;
  "interface" :string;
  "op" :string;
  "namespace" :string;
  "using" :string;
  "is" :string;
  "extends" :string;
  "alias" :string;
  "const" :string;
  // etc...
}

Checklist

  • Follow our Code of Conduct
  • Read the docs.
  • Check that there isn't already an issue that request the same feature to avoid creating a duplicate.

Metadata

Metadata

Assignees

No one assigned

    Labels

    compiler:coreIssues for @typespec/compilerfeatureNew feature or request

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions