@typespec/prettier-plugin-typespec 0.56.0-dev.3 → 0.57.0-dev.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.
- package/dist/index.js +12 -4
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -669,6 +669,12 @@ const diagnostics = {
|
|
|
669
669
|
withDetails: paramMessage `Type '${"sourceType"}' is not assignable to type '${"targetType"}'\n ${"details"}`,
|
|
670
670
|
},
|
|
671
671
|
},
|
|
672
|
+
"property-required": {
|
|
673
|
+
severity: "error",
|
|
674
|
+
messages: {
|
|
675
|
+
default: paramMessage `Property '${"propName"}' is required in type '${"targetType"}' but here is optional.`,
|
|
676
|
+
},
|
|
677
|
+
},
|
|
672
678
|
"no-prop": {
|
|
673
679
|
severity: "error",
|
|
674
680
|
messages: {
|
|
@@ -5928,7 +5934,7 @@ function createParser(code, options = {}) {
|
|
|
5928
5934
|
item = parseScalarStatement(pos, decorators);
|
|
5929
5935
|
break;
|
|
5930
5936
|
case Token.NamespaceKeyword:
|
|
5931
|
-
item = parseNamespaceStatement(pos, decorators, docs);
|
|
5937
|
+
item = parseNamespaceStatement(pos, decorators, docs, directives);
|
|
5932
5938
|
break;
|
|
5933
5939
|
case Token.InterfaceKeyword:
|
|
5934
5940
|
item = parseInterfaceStatement(pos, decorators);
|
|
@@ -5968,8 +5974,8 @@ function createParser(code, options = {}) {
|
|
|
5968
5974
|
item = parseInvalidStatement(pos, decorators);
|
|
5969
5975
|
break;
|
|
5970
5976
|
}
|
|
5971
|
-
mutate(item).directives = directives;
|
|
5972
5977
|
if (tok !== Token.NamespaceKeyword) {
|
|
5978
|
+
mutate(item).directives = directives;
|
|
5973
5979
|
mutate(item).docs = docs;
|
|
5974
5980
|
}
|
|
5975
5981
|
if (isBlocklessNamespace(item)) {
|
|
@@ -6019,7 +6025,7 @@ function createParser(code, options = {}) {
|
|
|
6019
6025
|
item = parseScalarStatement(pos, decorators);
|
|
6020
6026
|
break;
|
|
6021
6027
|
case Token.NamespaceKeyword:
|
|
6022
|
-
const ns = parseNamespaceStatement(pos, decorators, docs);
|
|
6028
|
+
const ns = parseNamespaceStatement(pos, decorators, docs, directives);
|
|
6023
6029
|
if (!Array.isArray(ns.statements)) {
|
|
6024
6030
|
error({ code: "blockless-namespace-first", messageId: "topLevel", target: ns });
|
|
6025
6031
|
}
|
|
@@ -6087,7 +6093,7 @@ function createParser(code, options = {}) {
|
|
|
6087
6093
|
}
|
|
6088
6094
|
return directives;
|
|
6089
6095
|
}
|
|
6090
|
-
function parseNamespaceStatement(pos, decorators, docs) {
|
|
6096
|
+
function parseNamespaceStatement(pos, decorators, docs, directives) {
|
|
6091
6097
|
parseExpected(Token.NamespaceKeyword);
|
|
6092
6098
|
let currentName = parseIdentifierOrMemberExpression();
|
|
6093
6099
|
const nsSegments = [];
|
|
@@ -6109,12 +6115,14 @@ function createParser(code, options = {}) {
|
|
|
6109
6115
|
id: nsSegments[0],
|
|
6110
6116
|
locals: undefined,
|
|
6111
6117
|
statements,
|
|
6118
|
+
directives: directives,
|
|
6112
6119
|
...finishNode(pos),
|
|
6113
6120
|
};
|
|
6114
6121
|
for (let i = 1; i < nsSegments.length; i++) {
|
|
6115
6122
|
outerNs = {
|
|
6116
6123
|
kind: SyntaxKind.NamespaceStatement,
|
|
6117
6124
|
decorators: [],
|
|
6125
|
+
directives: [],
|
|
6118
6126
|
id: nsSegments[i],
|
|
6119
6127
|
statements: outerNs,
|
|
6120
6128
|
locals: undefined,
|