@typespec/compiler 0.56.0-dev.8 → 0.56.0

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.
Files changed (54) hide show
  1. package/dist/manifest.js +2 -2
  2. package/dist/src/core/checker.d.ts.map +1 -1
  3. package/dist/src/core/checker.js +88 -42
  4. package/dist/src/core/checker.js.map +1 -1
  5. package/dist/src/core/helpers/type-name-utils.js +10 -1
  6. package/dist/src/core/helpers/type-name-utils.js.map +1 -1
  7. package/dist/src/core/install.js +2 -2
  8. package/dist/src/core/install.js.map +1 -1
  9. package/dist/src/core/messages.d.ts +20 -2
  10. package/dist/src/core/messages.d.ts.map +1 -1
  11. package/dist/src/core/messages.js +6 -0
  12. package/dist/src/core/messages.js.map +1 -1
  13. package/dist/src/core/node-host.d.ts.map +1 -1
  14. package/dist/src/core/node-host.js +2 -3
  15. package/dist/src/core/node-host.js.map +1 -1
  16. package/dist/src/core/parser.d.ts.map +1 -1
  17. package/dist/src/core/parser.js +6 -4
  18. package/dist/src/core/parser.js.map +1 -1
  19. package/dist/src/core/program.d.ts.map +1 -1
  20. package/dist/src/core/program.js +8 -3
  21. package/dist/src/core/program.js.map +1 -1
  22. package/dist/src/core/projector.d.ts.map +1 -1
  23. package/dist/src/core/projector.js +3 -1
  24. package/dist/src/core/projector.js.map +1 -1
  25. package/dist/src/core/types.d.ts +15 -0
  26. package/dist/src/core/types.d.ts.map +1 -1
  27. package/dist/src/core/types.js.map +1 -1
  28. package/dist/src/lib/decorators.d.ts +1 -3
  29. package/dist/src/lib/decorators.d.ts.map +1 -1
  30. package/dist/src/lib/decorators.js +0 -8
  31. package/dist/src/lib/decorators.js.map +1 -1
  32. package/dist/src/lib/intrinsic-decorators.d.ts +6 -0
  33. package/dist/src/lib/intrinsic-decorators.d.ts.map +1 -0
  34. package/dist/src/lib/intrinsic-decorators.js +10 -0
  35. package/dist/src/lib/intrinsic-decorators.js.map +1 -0
  36. package/dist/src/server/type-signature.js +1 -2
  37. package/dist/src/server/type-signature.js.map +1 -1
  38. package/dist/src/testing/test-host.js +2 -2
  39. package/dist/src/testing/test-host.js.map +1 -1
  40. package/dist/src/testing/test-utils.js +1 -1
  41. package/dist/src/testing/test-utils.js.map +1 -1
  42. package/lib/{lib.tsp → intrinsics.tsp} +3 -75
  43. package/lib/{decorators.tsp → std/decorators.tsp} +1 -1
  44. package/lib/std/main.tsp +5 -0
  45. package/lib/std/types.tsp +76 -0
  46. package/package.json +11 -14
  47. package/templates/scaffolding.json +4 -4
  48. package/dist/src/core/fetch.d.ts +0 -11
  49. package/dist/src/core/fetch.d.ts.map +0 -1
  50. package/dist/src/core/fetch.js +0 -38
  51. package/dist/src/core/fetch.js.map +0 -1
  52. package/lib/main.tsp +0 -4
  53. /package/lib/{projected-names.tsp → std/projected-names.tsp} +0 -0
  54. /package/lib/{reflection.tsp → std/reflection.tsp} +0 -0
package/dist/manifest.js CHANGED
@@ -1,4 +1,4 @@
1
1
  export default {
2
- "version": "0.56.0-dev.8",
3
- "commit": "b4caac6425b6870dfb8f2c818041eb112e84473a"
2
+ "version": "0.56.0",
3
+ "commit": "dec504364c90ff0769e2733326681e717c06f589"
4
4
  };
@@ -1 +1 @@
1
- {"version":3,"file":"checker.d.ts","sourceRoot":"","sources":["../../../src/core/checker.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,eAAe,EAIhB,MAAM,oBAAoB,CAAC;AAS5B,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAUzD,OAAO,EAIL,cAAc,EACd,kBAAkB,EASlB,UAAU,EACV,gBAAgB,EAMhB,SAAS,EAKT,YAAY,EAEZ,cAAc,EAId,mBAAmB,EAEnB,gBAAgB,EAChB,WAAW,EACX,WAAW,EAOX,KAAK,EAGL,aAAa,EAIb,SAAS,EACT,sBAAsB,EACtB,SAAS,EACT,IAAI,EAEJ,cAAc,EACd,kBAAkB,EAiBlB,cAAc,EAGd,uBAAuB,EAIvB,MAA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AE,KAAK,2CAapD;AAYD,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,GAAG,CAAC,CAEpF"}
@@ -1,4 +1,5 @@
1
- import { $docFromComment, getIndexer, isArrayModelType } from "../lib/decorators.js";
1
+ import { $docFromComment, isArrayModelType } from "../lib/decorators.js";
2
+ import { getIndexer } from "../lib/intrinsic-decorators.js";
2
3
  import { MultiKeyMap, createRekeyableMap, isArray, mutate } from "../utils/misc.js";
3
4
  import { createSymbol, createSymbolTable } from "./binder.js";
4
5
  import { createChangeIdentifierCodeFix } from "./compiler-code-fixes/change-identifier.codefix.js";
@@ -76,9 +77,6 @@ export function createChecker(program) {
76
77
  }
77
78
  const typespecNamespaceBinding = globalNamespaceNode.symbol.exports.get("TypeSpec");
78
79
  if (typespecNamespaceBinding) {
79
- // the TypeSpec namespace binding will be absent if we've passed
80
- // the no-std-lib option.
81
- // the first declaration here is the JS file for the TypeSpec script.
82
80
  initializeTypeSpecIntrinsics();
83
81
  for (const file of program.sourceFiles.values()) {
84
82
  addUsingSymbols(typespecNamespaceBinding.exports, file.locals);
@@ -1029,6 +1027,7 @@ export function createChecker(program) {
1029
1027
  properties: properties,
1030
1028
  decorators: [],
1031
1029
  derivedModels: [],
1030
+ sourceModels: [],
1032
1031
  });
1033
1032
  const indexers = [];
1034
1033
  const modelOptions = options.filter((entry) => {
@@ -1057,6 +1056,7 @@ export function createChecker(program) {
1057
1056
  }
1058
1057
  }
1059
1058
  for (const [_, option] of modelOptions) {
1059
+ intersection.sourceModels.push({ usage: "intersection", model: option });
1060
1060
  const allProps = walkPropertiesInherited(option);
1061
1061
  for (const prop of allProps) {
1062
1062
  if (properties.has(prop.name)) {
@@ -1208,7 +1208,7 @@ export function createChecker(program) {
1208
1208
  }
1209
1209
  }
1210
1210
  if (mapper === undefined && inInterface) {
1211
- compilerAssert(parentInterface, "Operation in interface should already have been checked.");
1211
+ compilerAssert(parentInterface, "Operation in interface should already have been checked.", node.parent);
1212
1212
  }
1213
1213
  checkTemplateDeclaration(node, mapper);
1214
1214
  // If we are instantating operation inside of interface
@@ -1223,26 +1223,37 @@ export function createChecker(program) {
1223
1223
  if (node.signature.kind === SyntaxKind.OperationSignatureReference) {
1224
1224
  // Attempt to resolve the operation
1225
1225
  const baseOperation = checkOperationIs(node, node.signature.baseOperation, mapper);
1226
- if (!baseOperation) {
1227
- return errorType;
1226
+ if (baseOperation) {
1227
+ sourceOperation = baseOperation;
1228
+ const parameterModelSym = getOrCreateAugmentedSymbolTable(symbol.metatypeMembers).get("parameters");
1229
+ // Reference the same return type and create the parameters type
1230
+ const clone = initializeClone(baseOperation.parameters, {
1231
+ properties: createRekeyableMap(),
1232
+ });
1233
+ clone.properties = createRekeyableMap(Array.from(baseOperation.parameters.properties.entries()).map(([key, prop]) => [
1234
+ key,
1235
+ cloneTypeForSymbol(getMemberSymbol(parameterModelSym, prop.name), prop, {
1236
+ model: clone,
1237
+ sourceProperty: prop,
1238
+ }),
1239
+ ]));
1240
+ parameters = finishType(clone);
1241
+ returnType = baseOperation.returnType;
1242
+ // Copy decorators from the base operation, inserting the base decorators first
1243
+ decorators = [...baseOperation.decorators];
1244
+ }
1245
+ else {
1246
+ // If we can't resolve the signature we return an empty model.
1247
+ parameters = createAndFinishType({
1248
+ kind: "Model",
1249
+ name: "",
1250
+ decorators: [],
1251
+ properties: createRekeyableMap(),
1252
+ derivedModels: [],
1253
+ sourceModels: [],
1254
+ });
1255
+ returnType = voidType;
1228
1256
  }
1229
- sourceOperation = baseOperation;
1230
- const parameterModelSym = getOrCreateAugmentedSymbolTable(symbol.metatypeMembers).get("parameters");
1231
- // Reference the same return type and create the parameters type
1232
- const clone = initializeClone(baseOperation.parameters, {
1233
- properties: createRekeyableMap(),
1234
- });
1235
- clone.properties = createRekeyableMap(Array.from(baseOperation.parameters.properties.entries()).map(([key, prop]) => [
1236
- key,
1237
- cloneTypeForSymbol(getMemberSymbol(parameterModelSym, prop.name), prop, {
1238
- model: clone,
1239
- sourceProperty: prop,
1240
- }),
1241
- ]));
1242
- parameters = finishType(clone);
1243
- returnType = baseOperation.returnType;
1244
- // Copy decorators from the base operation, inserting the base decorators first
1245
- decorators = [...baseOperation.decorators];
1246
1257
  }
1247
1258
  else {
1248
1259
  parameters = getTypeForNode(node.signature.parameters, mapper);
@@ -1668,10 +1679,22 @@ export function createChecker(program) {
1668
1679
  }
1669
1680
  // when resolving a type reference based on an alias, unwrap the alias.
1670
1681
  if (base.flags & 2048 /* SymbolFlags.Alias */) {
1671
- base = getAliasedSymbol(base, mapper, options);
1672
- if (!base) {
1682
+ const aliasedSym = getAliasedSymbol(base, mapper, options);
1683
+ if (!aliasedSym) {
1684
+ reportCheckerDiagnostic(createDiagnostic({
1685
+ code: "invalid-ref",
1686
+ messageId: "node",
1687
+ format: {
1688
+ id: node.id.sv,
1689
+ nodeName: base.declarations[0]
1690
+ ? SyntaxKind[base.declarations[0].kind]
1691
+ : "Unknown node",
1692
+ },
1693
+ target: node,
1694
+ }));
1673
1695
  return undefined;
1674
1696
  }
1697
+ base = aliasedSym;
1675
1698
  }
1676
1699
  if (node.selector === ".") {
1677
1700
  return resolveMemberInContainer(node, base, mapper, options);
@@ -1800,11 +1823,18 @@ export function createChecker(program) {
1800
1823
  while (current.flags & 2048 /* SymbolFlags.Alias */) {
1801
1824
  const node = current.declarations[0];
1802
1825
  const targetNode = node.kind === SyntaxKind.AliasStatement ? node.value : node;
1803
- const sym = resolveTypeReferenceSymInternal(targetNode, mapper, options);
1804
- if (sym === undefined) {
1826
+ if (targetNode.kind === SyntaxKind.TypeReference ||
1827
+ targetNode.kind === SyntaxKind.MemberExpression ||
1828
+ targetNode.kind === SyntaxKind.Identifier) {
1829
+ const sym = resolveTypeReferenceSymInternal(targetNode, mapper, options);
1830
+ if (sym === undefined) {
1831
+ return undefined;
1832
+ }
1833
+ current = sym;
1834
+ }
1835
+ else {
1805
1836
  return undefined;
1806
1837
  }
1807
- current = sym;
1808
1838
  }
1809
1839
  const sym = current;
1810
1840
  const node = aliasSymbol.declarations[0];
@@ -1956,12 +1986,14 @@ export function createChecker(program) {
1956
1986
  properties: createRekeyableMap(),
1957
1987
  namespace: getParentNamespaceType(node),
1958
1988
  decorators,
1989
+ sourceModels: [],
1959
1990
  derivedModels: [],
1960
1991
  });
1961
1992
  linkType(links, type, mapper);
1962
1993
  const isBase = checkModelIs(node, node.is, mapper);
1963
1994
  if (isBase) {
1964
1995
  type.sourceModel = isBase;
1996
+ type.sourceModels.push({ usage: "is", model: isBase });
1965
1997
  // copy decorators
1966
1998
  decorators.push(...isBase.decorators);
1967
1999
  if (isBase.indexer) {
@@ -2024,7 +2056,7 @@ export function createChecker(program) {
2024
2056
  return false;
2025
2057
  }
2026
2058
  // Some of the mapper args are still template parameter so we shouldn't create the type.
2027
- return mapper.args.every((t) => t.kind !== "TemplateParameter");
2059
+ return !mapper.partial && mapper.args.every((t) => t.kind !== "TemplateParameter");
2028
2060
  }
2029
2061
  function checkModelExpression(node, mapper) {
2030
2062
  const properties = createRekeyableMap();
@@ -2037,6 +2069,7 @@ export function createChecker(program) {
2037
2069
  namespace: getParentNamespaceType(node),
2038
2070
  decorators: [],
2039
2071
  derivedModels: [],
2072
+ sourceModels: [],
2040
2073
  });
2041
2074
  checkModelProperties(node, properties, type, mapper);
2042
2075
  return finishType(type);
@@ -2519,6 +2552,7 @@ export function createChecker(program) {
2519
2552
  target: targetNode,
2520
2553
  }));
2521
2554
  }
2555
+ parentModel.sourceModels.push({ usage: "spread", model: targetType });
2522
2556
  const props = [];
2523
2557
  // copy each property
2524
2558
  for (const prop of walkPropertiesInherited(targetType)) {
@@ -2666,7 +2700,7 @@ export function createChecker(program) {
2666
2700
  if (symbolLinks.declaredType === undefined) {
2667
2701
  const decoratorDeclNode = sym.declarations.find((x) => x.kind === SyntaxKind.DecoratorDeclarationStatement);
2668
2702
  if (decoratorDeclNode) {
2669
- checkDecoratorDeclaration(decoratorDeclNode, mapper);
2703
+ checkDecoratorDeclaration(decoratorDeclNode, undefined);
2670
2704
  }
2671
2705
  }
2672
2706
  if (symbolLinks.declaredType) {
@@ -3033,17 +3067,15 @@ export function createChecker(program) {
3033
3067
  const ownMembers = new Map();
3034
3068
  for (const opNode of node.operations) {
3035
3069
  const opType = checkOperation(opNode, mapper, interfaceType);
3036
- if (opType.kind === "Operation") {
3037
- if (ownMembers.has(opType.name)) {
3038
- reportCheckerDiagnostic(createDiagnostic({
3039
- code: "interface-duplicate",
3040
- format: { name: opType.name },
3041
- target: opNode,
3042
- }));
3043
- continue;
3044
- }
3045
- ownMembers.set(opType.name, opType);
3070
+ if (ownMembers.has(opType.name)) {
3071
+ reportCheckerDiagnostic(createDiagnostic({
3072
+ code: "interface-duplicate",
3073
+ format: { name: opType.name },
3074
+ target: opNode,
3075
+ }));
3076
+ continue;
3046
3077
  }
3078
+ ownMembers.set(opType.name, opType);
3047
3079
  }
3048
3080
  return ownMembers;
3049
3081
  }
@@ -3499,7 +3531,9 @@ export function createChecker(program) {
3499
3531
  clone.decorators.push(dec);
3500
3532
  }
3501
3533
  }
3502
- clone = finishType(clone);
3534
+ if (type.isFinished) {
3535
+ clone = finishType(clone);
3536
+ }
3503
3537
  compilerAssert(clone.kind === type.kind, "cloneType must not change type kind");
3504
3538
  return clone;
3505
3539
  }
@@ -3640,6 +3674,7 @@ export function createChecker(program) {
3640
3674
  decorators: [],
3641
3675
  properties: createRekeyableMap(),
3642
3676
  derivedModels: [],
3677
+ sourceModels: [],
3643
3678
  });
3644
3679
  for (const propNode of node.properties) {
3645
3680
  if (propNode.kind === SyntaxKind.ProjectionModelProperty) {
@@ -4334,6 +4369,16 @@ export function createChecker(program) {
4334
4369
  }
4335
4370
  else {
4336
4371
  remainingProperties.delete(prop.name);
4372
+ if (sourceProperty.optional && !prop.optional) {
4373
+ diagnostics.push(createDiagnostic({
4374
+ code: "property-required",
4375
+ format: {
4376
+ propName: prop.name,
4377
+ targetType: getTypeName(target),
4378
+ },
4379
+ target: diagnosticTarget,
4380
+ }));
4381
+ }
4337
4382
  const [related, propDiagnostics] = isTypeAssignableToInternal(sourceProperty.type, prop.type, diagnosticTarget, relationCache);
4338
4383
  if (!related) {
4339
4384
  diagnostics.push(...propDiagnostics);
@@ -4643,6 +4688,7 @@ export function filterModelProperties(program, model, filter) {
4643
4688
  properties,
4644
4689
  decorators: [],
4645
4690
  derivedModels: [],
4691
+ sourceModels: [{ usage: "spread", model }],
4646
4692
  });
4647
4693
  for (const property of walkPropertiesInherited(model)) {
4648
4694
  if (filter(property)) {