@effect/language-service 0.62.0 → 0.62.1
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 +10 -2
- package/cli.js.map +1 -1
- package/effect-lsp-patch-utils.js +10 -2
- package/effect-lsp-patch-utils.js.map +1 -1
- package/index.js +10 -2
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/transform.js +10 -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,
|
|
@@ -5936,13 +5942,15 @@ var processArrayType = fn(
|
|
|
5936
5942
|
"StructuralSchemaGen.processArrayType"
|
|
5937
5943
|
)(
|
|
5938
5944
|
function* (type, context) {
|
|
5939
|
-
const { createApiCall, typeChecker } = yield* service(StructuralSchemaGenContext);
|
|
5945
|
+
const { createApiCall, typeChecker, typeCheckerUtils } = yield* service(StructuralSchemaGenContext);
|
|
5940
5946
|
const typeArgs = typeChecker.getTypeArguments(type);
|
|
5941
5947
|
if (typeArgs.length === 0) {
|
|
5942
5948
|
return yield* fail(new UnsupportedTypeError(type, "Array type has no type arguments"));
|
|
5943
5949
|
}
|
|
5944
5950
|
const elementSchema = yield* processType(typeArgs[0], context);
|
|
5945
|
-
|
|
5951
|
+
const expr = createApiCall("Array", [elementSchema]);
|
|
5952
|
+
if (typeCheckerUtils.isReadonlyArrayType(type)) return [expr, false];
|
|
5953
|
+
return [createApiCall("mutable", [expr]), false];
|
|
5946
5954
|
}
|
|
5947
5955
|
);
|
|
5948
5956
|
var processTupleType = fn(
|