@effect/language-service 0.62.0 → 0.62.2
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/cli.js +11 -2
- package/cli.js.map +1 -1
- package/effect-lsp-patch-utils.js +11 -2
- package/effect-lsp-patch-utils.js.map +1 -1
- package/index.js +11 -2
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/transform.js +11 -2
- package/transform.js.map +1 -1
package/package.json
CHANGED
package/transform.js
CHANGED
|
@@ -2185,6 +2185,8 @@ var nanoLayer2 = (fa) => pipe(
|
|
|
2185
2185
|
)
|
|
2186
2186
|
);
|
|
2187
2187
|
function makeTypeCheckerUtils(ts, typeChecker, tsUtils) {
|
|
2188
|
+
const readonlyArraySymbol = typeChecker.resolveName("ReadonlyArray", void 0, ts.SymbolFlags.Type, false);
|
|
2189
|
+
const globalReadonlyArrayType = readonlyArraySymbol ? typeChecker.getDeclaredTypeOfSymbol(readonlyArraySymbol) : void 0;
|
|
2188
2190
|
function isUnion(type) {
|
|
2189
2191
|
return !!(type.flags & ts.TypeFlags.Union);
|
|
2190
2192
|
}
|
|
@@ -2194,6 +2196,9 @@ function makeTypeCheckerUtils(ts, typeChecker, tsUtils) {
|
|
|
2194
2196
|
function isThisTypeParameter(type) {
|
|
2195
2197
|
return !!(type.flags & ts.TypeFlags.TypeParameter && type.isThisType);
|
|
2196
2198
|
}
|
|
2199
|
+
function isReadonlyArrayType(type) {
|
|
2200
|
+
return type && "target" in type && type.target === globalReadonlyArrayType;
|
|
2201
|
+
}
|
|
2197
2202
|
function isMissingIntrinsicType(type) {
|
|
2198
2203
|
return (type.flags & ts.TypeFlags.Undefined) !== 0 && "debugIntrinsicName" in type && type.debugIntrinsicName === "missing";
|
|
2199
2204
|
}
|
|
@@ -2501,6 +2506,7 @@ function makeTypeCheckerUtils(ts, typeChecker, tsUtils) {
|
|
|
2501
2506
|
}
|
|
2502
2507
|
return {
|
|
2503
2508
|
isUnion,
|
|
2509
|
+
isReadonlyArrayType,
|
|
2504
2510
|
isMissingIntrinsicType,
|
|
2505
2511
|
getTypeParameterAtPosition,
|
|
2506
2512
|
getMissingTypeEntriesInTargetType,
|
|
@@ -5774,6 +5780,7 @@ var processType = fn(
|
|
|
5774
5780
|
if (!isSame) {
|
|
5775
5781
|
const usedCount = usedGlobalIdentifiers.get(hoistName) || 0;
|
|
5776
5782
|
hoistName = usedCount > 0 ? hoistName + "_" + usedCount : hoistName;
|
|
5783
|
+
usedGlobalIdentifiers.set(hoistName, usedCount + 1);
|
|
5777
5784
|
}
|
|
5778
5785
|
}
|
|
5779
5786
|
}
|
|
@@ -5936,13 +5943,15 @@ var processArrayType = fn(
|
|
|
5936
5943
|
"StructuralSchemaGen.processArrayType"
|
|
5937
5944
|
)(
|
|
5938
5945
|
function* (type, context) {
|
|
5939
|
-
const { createApiCall, typeChecker } = yield* service(StructuralSchemaGenContext);
|
|
5946
|
+
const { createApiCall, typeChecker, typeCheckerUtils } = yield* service(StructuralSchemaGenContext);
|
|
5940
5947
|
const typeArgs = typeChecker.getTypeArguments(type);
|
|
5941
5948
|
if (typeArgs.length === 0) {
|
|
5942
5949
|
return yield* fail(new UnsupportedTypeError(type, "Array type has no type arguments"));
|
|
5943
5950
|
}
|
|
5944
5951
|
const elementSchema = yield* processType(typeArgs[0], context);
|
|
5945
|
-
|
|
5952
|
+
const expr = createApiCall("Array", [elementSchema]);
|
|
5953
|
+
if (typeCheckerUtils.isReadonlyArrayType(type)) return [expr, false];
|
|
5954
|
+
return [createApiCall("mutable", [expr]), false];
|
|
5946
5955
|
}
|
|
5947
5956
|
);
|
|
5948
5957
|
var processTupleType = fn(
|