@typespec/compiler 0.43.0-dev.5 → 0.43.0-dev.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,7 +8,7 @@ import { getIdentifierContext, hasParseError, visitChildren } from "./parser.js"
8
8
  import { createProjectionMembers } from "./projection-members.js";
9
9
  import { getParentTemplateNode, isNeverType, isTemplateInstance, isUnknownType, isVoidType, } from "./type-utils.js";
10
10
  import { IdentifierKind, SyntaxKind, } from "./types.js";
11
- import { isArray, MultiKeyMap, mutate } from "./util.js";
11
+ import { createRekeyableMap, isArray, MultiKeyMap, mutate } from "./util.js";
12
12
  /**
13
13
  * Maps type arguments to type instantiation.
14
14
  */
@@ -754,7 +754,7 @@ export function createChecker(program) {
754
754
  return Array.from(this.variants.values()).map((v) => v.type);
755
755
  },
756
756
  expression: true,
757
- variants: new Map(),
757
+ variants: createRekeyableMap(),
758
758
  decorators: [],
759
759
  });
760
760
  for (const o of node.options) {
@@ -873,7 +873,7 @@ export function createChecker(program) {
873
873
  return parameterType;
874
874
  }
875
875
  function mergeModelTypes(node, options, mapper) {
876
- const properties = new Map();
876
+ const properties = createRekeyableMap();
877
877
  const intersection = createType({
878
878
  kind: "Model",
879
879
  node,
@@ -1637,7 +1637,7 @@ export function createChecker(program) {
1637
1637
  kind: "Model",
1638
1638
  name: node.id.sv,
1639
1639
  node: node,
1640
- properties: new Map(),
1640
+ properties: createRekeyableMap(),
1641
1641
  namespace: getParentNamespaceType(node),
1642
1642
  decorators,
1643
1643
  derivedModels: [],
@@ -1717,7 +1717,7 @@ export function createChecker(program) {
1717
1717
  return mapper.args.every((t) => t.kind !== "TemplateParameter");
1718
1718
  }
1719
1719
  function checkModelExpression(node, mapper) {
1720
- const properties = new Map();
1720
+ const properties = createRekeyableMap();
1721
1721
  const type = createType({
1722
1722
  kind: "Model",
1723
1723
  name: "",
@@ -2377,7 +2377,7 @@ export function createChecker(program) {
2377
2377
  kind: "Enum",
2378
2378
  name: node.id.sv,
2379
2379
  node,
2380
- members: new Map(),
2380
+ members: createRekeyableMap(),
2381
2381
  decorators: [],
2382
2382
  }));
2383
2383
  const memberNames = new Set();
@@ -2423,7 +2423,7 @@ export function createChecker(program) {
2423
2423
  decorators: [],
2424
2424
  node,
2425
2425
  namespace: getParentNamespaceType(node),
2426
- operations: new Map(),
2426
+ operations: createRekeyableMap(),
2427
2427
  name: node.id.sv,
2428
2428
  });
2429
2429
  interfaceType.decorators = checkDecorators(interfaceType, node, mapper);
@@ -2487,7 +2487,7 @@ export function createChecker(program) {
2487
2487
  // we're not instantiating this union and we've already checked it
2488
2488
  return links.declaredType;
2489
2489
  }
2490
- const variants = new Map();
2490
+ const variants = createRekeyableMap();
2491
2491
  const unionType = createType({
2492
2492
  kind: "Union",
2493
2493
  decorators: [],
@@ -2793,7 +2793,7 @@ export function createChecker(program) {
2793
2793
  ...additionalProps,
2794
2794
  });
2795
2795
  if (!("properties" in additionalProps)) {
2796
- newModel.properties = new Map(Array.from(type.properties.entries()).map(([key, prop]) => [
2796
+ newModel.properties = createRekeyableMap(Array.from(type.properties.entries()).map(([key, prop]) => [
2797
2797
  key,
2798
2798
  cloneType(prop, { model: newModel }),
2799
2799
  ]));
@@ -2811,7 +2811,7 @@ export function createChecker(program) {
2811
2811
  ...additionalProps,
2812
2812
  });
2813
2813
  if (!("variants" in additionalProps)) {
2814
- newUnion.variants = new Map(Array.from(type.variants.entries()).map(([key, prop]) => [
2814
+ newUnion.variants = createRekeyableMap(Array.from(type.variants.entries()).map(([key, prop]) => [
2815
2815
  key,
2816
2816
  cloneType(prop, { union: newUnion }),
2817
2817
  ]));
@@ -2826,7 +2826,7 @@ export function createChecker(program) {
2826
2826
  ...additionalProps,
2827
2827
  });
2828
2828
  if (!("operations" in additionalProps)) {
2829
- newInterface.operations = new Map(Array.from(type.operations.entries()).map(([key, prop]) => [
2829
+ newInterface.operations = createRekeyableMap(Array.from(type.operations.entries()).map(([key, prop]) => [
2830
2830
  key,
2831
2831
  cloneType(prop, { interface: newInterface }),
2832
2832
  ]));
@@ -2841,7 +2841,7 @@ export function createChecker(program) {
2841
2841
  ...additionalProps,
2842
2842
  });
2843
2843
  if (!("members" in additionalProps)) {
2844
- newEnum.members = new Map(Array.from(type.members.entries()).map(([key, prop]) => [
2844
+ newEnum.members = createRekeyableMap(Array.from(type.members.entries()).map(([key, prop]) => [
2845
2845
  key,
2846
2846
  cloneType(prop, { enum: newEnum }),
2847
2847
  ]));
@@ -2982,7 +2982,7 @@ export function createChecker(program) {
2982
2982
  name: "",
2983
2983
  node: node,
2984
2984
  decorators: [],
2985
- properties: new Map(),
2985
+ properties: createRekeyableMap(),
2986
2986
  derivedModels: [],
2987
2987
  });
2988
2988
  for (const propNode of node.properties) {
@@ -3901,7 +3901,7 @@ export function filterModelProperties(program, model, filter) {
3901
3901
  if (!filtered) {
3902
3902
  return model;
3903
3903
  }
3904
- const properties = new Map();
3904
+ const properties = createRekeyableMap();
3905
3905
  const newModel = program.checker.createType({
3906
3906
  kind: "Model",
3907
3907
  node: undefined,