@azure-tools/typespec-ts 0.57.1-dev.5 → 0.57.1-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.
- package/dist/src/modular/helpers/operation-helpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/operation-helpers.js +11 -16
- package/dist/src/modular/helpers/operation-helpers.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +9 -9
- package/src/modular/helpers/operation-helpers.ts +13 -14
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@azure-tools/typespec-ts",
|
|
3
|
-
"version": "0.57.1-dev.
|
|
3
|
+
"version": "0.57.1-dev.6",
|
|
4
4
|
"description": "A TypeSpec emitter for TypeScript",
|
|
5
5
|
"main": "dist/src/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -41,24 +41,24 @@
|
|
|
41
41
|
"yaml": "^2.9.0",
|
|
42
42
|
"@azure-tools/spector-runner": "^0.1.0",
|
|
43
43
|
"@typespec/spector": "^0.1.0-alpha.29",
|
|
44
|
-
"@typespec/tspd": "^0.77.1",
|
|
45
|
-
"@typespec/compiler": "^1.16.0",
|
|
46
44
|
"@typespec/spec-api": "^0.1.0-alpha.17",
|
|
47
45
|
"@typespec/http-specs": "^0.1.0-alpha.43",
|
|
46
|
+
"@typespec/tspd": "^0.77.1",
|
|
47
|
+
"@typespec/compiler": "^1.16.0",
|
|
48
|
+
"@typespec/http": "^1.16.0",
|
|
48
49
|
"@typespec/openapi": "^1.16.0",
|
|
49
|
-
"@typespec/rest": "^0.86.0",
|
|
50
50
|
"@typespec/versioning": "^0.86.0",
|
|
51
|
-
"@typespec/
|
|
52
|
-
"@typespec/
|
|
51
|
+
"@typespec/rest": "^0.86.0",
|
|
52
|
+
"@typespec/xml": "^0.86.0"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"@azure-tools/typespec-azure-core": "^0.72.0 || >= 0.73.0-dev.1",
|
|
56
56
|
"@azure-tools/typespec-client-generator-core": "^0.72.1 || >= 0.73.0-dev.6",
|
|
57
|
-
"@typespec/compiler": "^1.16.0",
|
|
58
57
|
"@typespec/http": "^1.16.0",
|
|
58
|
+
"@typespec/compiler": "^1.16.0",
|
|
59
59
|
"@typespec/rest": "^0.86.0",
|
|
60
|
-
"@typespec/
|
|
61
|
-
"@typespec/
|
|
60
|
+
"@typespec/versioning": "^0.86.0",
|
|
61
|
+
"@typespec/xml": "^0.86.0"
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
64
|
"fast-xml-parser": "^5.11.0",
|
|
@@ -985,22 +985,21 @@ export function getOperationFunction(
|
|
|
985
985
|
responseHeaders.length > 0
|
|
986
986
|
? buildHeaderOnlyResponseType(context, responseHeaders)
|
|
987
987
|
: "Record<string, unknown>";
|
|
988
|
+
const emptyBodyType = hasResponseBody && response.optional ? "void" : "undefined";
|
|
989
|
+
const emptyResponseType =
|
|
990
|
+
responseHeaders.length > 0
|
|
991
|
+
? `${headersType} & ${storageCompatInfoRef}<${emptyBodyType}, ${headersType}>`
|
|
992
|
+
: `${storageCompatInfoRef}<${emptyBodyType}, ${headersType}>`;
|
|
988
993
|
if (!hasResponseBody) {
|
|
989
|
-
|
|
990
|
-
// Void with headers — headers at top level + StorageCompatResponseInfo
|
|
991
|
-
finalReturnType = `${headersType} & ${storageCompatInfoRef}<undefined, ${headersType}>`;
|
|
992
|
-
} else {
|
|
993
|
-
// Void without headers — just StorageCompatResponseInfo
|
|
994
|
-
finalReturnType = `${storageCompatInfoRef}<undefined, ${headersType}>`;
|
|
995
|
-
}
|
|
994
|
+
finalReturnType = emptyResponseType;
|
|
996
995
|
} else {
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
996
|
+
const bodyResponseType =
|
|
997
|
+
responseHeaders.length > 0
|
|
998
|
+
? `${headersType} & ${bodyType} & ${storageCompatInfoRef}<${bodyType}, ${headersType}>`
|
|
999
|
+
: `${bodyType} & ${storageCompatInfoRef}<${bodyType}, ${headersType}>`;
|
|
1000
|
+
finalReturnType = response.optional
|
|
1001
|
+
? `${bodyResponseType} | ${emptyResponseType}`
|
|
1002
|
+
: bodyResponseType;
|
|
1004
1003
|
}
|
|
1005
1004
|
}
|
|
1006
1005
|
|