@tslite/checker 1.5.0 → 1.6.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.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { VarSchema, Schema, Schemes, TypeScheme, ObjectSchema, Completion } from './types/index.cjs';
2
- export { AnySchema, ApplySchema, ArraySchema, Bindings, DEFAULT_TYPE_LIMITS, Discovery, ElementFlag, FnSchema, GuardSig, INSTANTIATION_COUNT_LIMIT, INSTANTIATION_DEPTH_LIMIT, Incompatibility, IncompatibilityKind, IndexSchema, Instantiation, InstantiationLimitError, KeyofSchema, LiteralSchema, MappedSchema, OverloadSchema, Param, PathSegment, Prop, ScalarSchema, TYPE_EVAL_DEPTH_LIMIT, TupleSchema, TypeEvalLimitError, TypeEvalLimits, TypeForm, TypePosition, UnionSchema, UnionTooComplexError, UnknownSchema, VarCandidates, WriteKey, apparentType, asLiteralOrigin, baseLiteralType, bindTypeParams, comparable, configureTypeLimits, contravariantInference, covariantInference, discover, equals, erasedSignature, expand1, flagAt, format, formatTypeArgs, formatTypeDiff, freeVars, groundVars, inferFromCandidates, inferredTypes, instantiate, instantiateInContextOf, instantiateLoose, isMissingType, isNumericLiteralName, isObjectOrArrayLiteral, isScheme, isSerializable, isVariadicTuple, join, joinAll, missingType, normalizeUnion, ownProp, readonlyMember, renameTypeParams, resetInstantiationCount, resetTypeLimits, resolveConditional, resolveOp, resolveTypeOp, restIndex, restTypeAtPosition, s, sampleValue, silentNever, substitute, subtype, typeAtPosition, typeDiff, typeFeatures, typeLimits, typeNeedsParens, typeParamArity, unify, widen, widenInferred, widenLiteral, widenOrigin, widenType, withUndefined, withoutUndefined } from './types/index.cjs';
2
+ export { AnySchema, ApplySchema, ArraySchema, Bindings, DEFAULT_TYPE_LIMITS, Discovery, ElementFlag, FnSchema, GuardSig, INSTANTIATION_COUNT_LIMIT, INSTANTIATION_DEPTH_LIMIT, Incompatibility, IncompatibilityKind, IndexSchema, Instantiation, InstantiationLimitError, KeyofSchema, LiteralSchema, MappedSchema, OverloadSchema, Param, PathSegment, Prop, ScalarSchema, TYPE_EVAL_DEPTH_LIMIT, TupleSchema, TypeEvalLimitError, TypeEvalLimits, TypeForm, TypePosition, UnionSchema, UnionTooComplexError, UnknownSchema, VarCandidates, WriteKey, apparentType, asLiteralOrigin, baseLiteralType, bindTypeParams, comparable, configureTypeLimits, contravariantInference, covariantInference, discover, equals, erasedSignature, expand1, flagAt, format, formatTypeArgs, formatTypeDiff, freeVars, groundVars, inferFromCandidates, inferredTypes, instantiate, instantiateInContextOf, instantiateLoose, isMissingType, isNumericLiteralName, isObjectOrArrayLiteral, isScheme, isSerializable, isVariadicTuple, join, joinAll, missingType, normalizeUnion, ownProp, readonlyMember, renameTypeParams, resetInstantiationCount, resetTypeLimits, resolveConditional, resolveOp, resolveTypeOp, restIndex, restTypeAtPosition, s, sampleValue, silentNever, substitute, subtype, typeAtPosition, typeDiff, typeFeatures, typeLimits, typeNeedsParens, typeParamArity, unify, version, widen, widenInferred, widenLiteral, widenOrigin, widenType, withUndefined, withoutUndefined } from './types/index.cjs';
3
3
  import { Scope as Scope$1, BaseNode, Node, types, SourceLocation, Expression } from '@tslite/ast';
4
4
  import { CapabilityProfile, CompiledProfile } from '@tslite/capability';
5
5
  import { Span } from '@tslite/language-service';
@@ -139,7 +139,7 @@ declare const resolveNamed: (env: Env, name: string) => Schema | undefined;
139
139
  declare const resolveScheme: (env: Env, name: string) => TypeScheme | undefined;
140
140
 
141
141
  type Severity = "error" | "warning";
142
- type DiagnosticCode = "not-assignable" | "unknown-name" | "not-callable" | "no-such-member" | "not-object" | "possibly-nullish" | "unknown-value" | "const-needs-init" | "cannot-redeclare" | "circular-type-alias" | "circular-type-annotation" | "unknown-module" | "not-a-schema" | "type-as-value" | "asserter-needs-name" | "shadows-schema" | "missing-argument" | "excess-argument" | "excess-property" | "spread-argument" | "required-after-optional" | "not-iterable" | "not-spreadable" | "implicit-any" | "props-mismatch" | "no-matching-overload" | "constraint-violation" | "wrong-type-argument-count" | "unsupported" | "unused-name" | "assign-to-const" | "for-in-destructuring" | "readonly-write" | "cast-unsound" | "unprovable-value" | "not-arithmetic-operand" | "operator-not-applicable" | "implicit-coercion" | "node-not-allowed" | "name-not-allowed" | "type-feature-not-allowed" | "any-not-allowed" | "narrowing-cast-not-allowed" | "too-deep" | "too-complex-union" | "too-large" | "wrong-result-type";
142
+ type DiagnosticCode = "not-assignable" | "unknown-name" | "not-callable" | "no-such-member" | "not-object" | "possibly-nullish" | "unknown-value" | "const-needs-init" | "cannot-redeclare" | "circular-type-alias" | "circular-type-annotation" | "unknown-module" | "not-a-schema" | "type-as-value" | "asserter-needs-name" | "shadows-schema" | "missing-argument" | "excess-argument" | "excess-property" | "spread-argument" | "required-after-optional" | "not-iterable" | "not-spreadable" | "overwritten-property" | "implicit-any" | "props-mismatch" | "no-matching-overload" | "constraint-violation" | "wrong-type-argument-count" | "unsupported" | "unused-name" | "assign-to-const" | "for-in-destructuring" | "readonly-write" | "cast-unsound" | "unprovable-value" | "not-arithmetic-operand" | "operator-not-applicable" | "implicit-coercion" | "node-not-allowed" | "name-not-allowed" | "type-feature-not-allowed" | "any-not-allowed" | "narrowing-cast-not-allowed" | "too-deep" | "too-complex-union" | "too-large" | "wrong-result-type";
143
143
  /**
144
144
  * A **classe** do diagnóstico — espelha a divisão de passes do `tsc` (que nós
145
145
  * fundimos num walk só): `semantic` é o que o **binder** do tsc pega (validade do
@@ -187,6 +187,16 @@ type DiagnosticData = {
187
187
  readonly kind: "implicit-coercion";
188
188
  readonly textConvertible: boolean;
189
189
  };
190
+ /**
191
+ * Outro lugar do programa que explica o diagnóstico — o `DiagnosticRelatedInformation` do
192
+ * tsc (`types.ts`), que o `addRelatedInfo` anexa, e o `relatedInformation` do LSP. O nó é
193
+ * por referência, como o do diagnóstico; a mensagem diz o papel dele ("This spread always
194
+ * overwrites this property.").
195
+ */
196
+ interface DiagnosticRelatedInformation {
197
+ readonly node: BaseNode;
198
+ readonly message: string;
199
+ }
190
200
  interface Diagnostic {
191
201
  readonly code: DiagnosticCode;
192
202
  /** A classe do diagnóstico (deriva do `code`) — ver {@link DiagnosticKind}. */
@@ -197,6 +207,8 @@ interface Diagnostic {
197
207
  readonly message: string;
198
208
  /** Ver {@link DiagnosticData}. Presente só onde há o que agir. */
199
209
  readonly data?: DiagnosticData;
210
+ /** Ver {@link DiagnosticRelatedInformation}. Presente só onde o tsc a anexa. */
211
+ readonly relatedInformation?: readonly DiagnosticRelatedInformation[];
200
212
  }
201
213
  /**
202
214
  * Builder genérico de diagnóstico (severidade configurável). Usado pelos
@@ -265,12 +277,41 @@ declare const diag: {
265
277
  requiredAfterOptional: (node: BaseNode) => Diagnostic;
266
278
  notIterable: (node: BaseNode, type: Schema) => Diagnostic;
267
279
  /**
268
- * O rest de um padrão de objeto (`{ a, ...rest }`) sobre uma fonte que não é objeto — o
269
- * TS2700 do tsc, no elemento do rest (`getTypeForBindingElement`, `checker.ts:7439`: o
270
- * `isValidSpreadType` da fonte). O código é o do conceito — a fonte não se espalha —, par do
271
- * `not-iterable` do padrão de array.
280
+ * A fonte não se espalha: o `isValidSpreadType` do tsc (`checker.ts:23342`) a recusa. O
281
+ * código é o do conceito, par do `not-iterable` do padrão de array; a mensagem diz o caso.
282
+ */
283
+ notSpreadable: {
284
+ /** TS2700: o rest de um padrão de objeto (`{ a, ...rest }`), no elemento do rest
285
+ * (`getTypeForBindingElement`, `checker.ts:7439`). D80. */
286
+ rest: (node: BaseNode) => Diagnostic;
287
+ /** TS2698: o spread num literal de objeto (`{ ...x }`), no membro `...x`
288
+ * (`checkObjectLiteral`, `checker.ts:23254`). */
289
+ spread: (node: BaseNode) => Diagnostic;
290
+ };
291
+ /**
292
+ * A chave escrita duas vezes num literal de objeto. O tsc a acusa por três mecanismos, e
293
+ * cada um é um diagnóstico com o texto e o nó dele; o conceito é um só, o do
294
+ * `cannot-redeclare` (D25).
295
+ */
296
+ duplicateKey: {
297
+ /** TS1117: a chave IDENTIFICADOR repetida, no modo estrito (o `bindObjectLiteralExpression`
298
+ * do binder, `binder.ts:2037`), na repetição. */
299
+ strict: (node: BaseNode) => Diagnostic;
300
+ /** TS2300: o nome repetido (o `checkGrammarObjectLiteralExpression`), na repetição, com o
301
+ * texto do nome como escrito. */
302
+ identifier: (node: BaseNode, text: string) => Diagnostic;
303
+ /** TS2718: a chave computada ligada tarde com o nome de uma prop ligada cedo (o
304
+ * `lateBindMember`), na chave tardia. */
305
+ lateBound: (node: BaseNode, name: string) => Diagnostic;
306
+ /** TS2733: a primeira declaração ligada cedo desse nome, no mesmo `lateBindMember`. */
307
+ alsoDeclared: (node: BaseNode, name: string) => Diagnostic;
308
+ };
309
+ /**
310
+ * TS2783: a prop escrita num literal de objeto que um spread seguinte sempre sobrescreve,
311
+ * na prop escrita, com o spread na informação relacionada (TS2785) — o
312
+ * `checkSpreadPropOverrides` do tsc (`checker.ts:23558`).
272
313
  */
273
- notSpreadable: (node: BaseNode) => Diagnostic;
314
+ overwrittenProperty: (node: BaseNode, name: string, spread: BaseNode) => Diagnostic;
274
315
  /**
275
316
  * O `any` que ninguém escreveu — o `noImplicitAny` do tsc 3.9.10, que faz parte do
276
317
  * `--strict` e está sempre ligado aqui (D81). Um código só, com o texto de cada caso (o
@@ -399,11 +440,13 @@ declare const diag: {
399
440
  /**
400
441
  * Coletor de diagnósticos — acumula durante o walk, sem `throw`.
401
442
  *
402
- * Guarda cada diagnóstico UMA vez: um segundo com o mesmo nó, o mesmo código e a mesma
403
- * mensagem não entra. É a coleção do tsc (`createDiagnosticCollection`, que insere pelo
404
- * `insertSorted` e não repete o que o `compareDiagnostics` acha igual), e é o que deixa
405
- * um argumento ser tipado mais de uma vez — as rodadas da chamada (D53, D81) — sem que o
406
- * erro de dentro dele saia duas vezes.
443
+ * Guarda cada diagnóstico UMA vez: um segundo com o mesmo nó, o mesmo código, a mesma
444
+ * mensagem e a mesma informação relacionada não entra. É a coleção do tsc
445
+ * (`createDiagnosticCollection`, que insere pelo `insertSorted` e não repete o que o
446
+ * `compareDiagnostics` acha igual — ele compara também o `relatedInformation`), e é o que
447
+ * deixa um argumento ser tipado mais de uma vez — as rodadas da chamada (D53, D81) — sem
448
+ * que o erro de dentro dele saia duas vezes. Dois diagnósticos que só diferem na
449
+ * informação relacionada são dois: `{ a: 1, ...o1, ...o2 }` acusa o `a` uma vez por spread.
407
450
  */
408
451
  interface DiagnosticSink {
409
452
  /** Diagnósticos coletados, na ordem em que foram reportados, sem repetição. */
@@ -876,4 +919,4 @@ declare function anchorDiagnostics<A>(root: object, diagnostics: readonly Diagno
876
919
  */
877
920
  declare function spanOf(text: string, loc: SourceLocation | null | undefined): Span | undefined;
878
921
 
879
- export { type AnchorDiagnosticsOptions, type AnchoredDiagnostic, type Anchors, BINARY_OP, BINARY_OPS, type BinaryOpCategory, type BinaryOpSpec, type BindingMap, type CheckOptions, type CheckResult, type CheckerErrorCode, Completion, type Diagnostic, type DiagnosticCode, type DiagnosticData, type DiagnosticKind, type DiagnosticSink, type Env, type EnvOptions, FUNCTION_KINDS, type Guard, type GuardContext, LOGICAL_OPS, type LogicalOpSpec, type LowerValueOptions, type MissingProperty, type Nominals, ObjectSchema, type Occurrence, type OpResult, type Profile, type ReferenceSymbol, Schema, Schemes, type Scope, type Severity, type Shorthand, type TypeOverlay, type TypeRefSite, TypeScheme, UNARY_OPS, type UnaryOpSpec, type UnusedOptions, VarSchema, anchorDiagnostics, annotate, annotateReturn, asExpression, binaryOpsProducing, calleeAllowlist, capabilityNodes, check, childScope, collectBindings, collectMutations, collectReferences, collectUnused, componentProps, componentPropsOf, contextualTypeAt, createAnchors, createEnv, createSink, diag, diagnosticsAt, extractModuleType, fromCapability, guard, guardsFromCompiled, lookup, lowerValue, makeDiagnostic, maxArgs, maxCallNesting, maxDepth, maxFunctionNesting, maxNestingOf, maxNodes, memberCompletions, memberDepth, opResultSchema, resolveNamed, resolveScheme, resultType, rootScope, sameSymbol, scopeAt, scopeCompletions, spanOf, typeAt, unaryOpsProducing, visibleNames };
922
+ export { type AnchorDiagnosticsOptions, type AnchoredDiagnostic, type Anchors, BINARY_OP, BINARY_OPS, type BinaryOpCategory, type BinaryOpSpec, type BindingMap, type CheckOptions, type CheckResult, type CheckerErrorCode, Completion, type Diagnostic, type DiagnosticCode, type DiagnosticData, type DiagnosticKind, type DiagnosticRelatedInformation, type DiagnosticSink, type Env, type EnvOptions, FUNCTION_KINDS, type Guard, type GuardContext, LOGICAL_OPS, type LogicalOpSpec, type LowerValueOptions, type MissingProperty, type Nominals, ObjectSchema, type Occurrence, type OpResult, type Profile, type ReferenceSymbol, Schema, Schemes, type Scope, type Severity, type Shorthand, type TypeOverlay, type TypeRefSite, TypeScheme, UNARY_OPS, type UnaryOpSpec, type UnusedOptions, VarSchema, anchorDiagnostics, annotate, annotateReturn, asExpression, binaryOpsProducing, calleeAllowlist, capabilityNodes, check, childScope, collectBindings, collectMutations, collectReferences, collectUnused, componentProps, componentPropsOf, contextualTypeAt, createAnchors, createEnv, createSink, diag, diagnosticsAt, extractModuleType, fromCapability, guard, guardsFromCompiled, lookup, lowerValue, makeDiagnostic, maxArgs, maxCallNesting, maxDepth, maxFunctionNesting, maxNestingOf, maxNodes, memberCompletions, memberDepth, opResultSchema, resolveNamed, resolveScheme, resultType, rootScope, sameSymbol, scopeAt, scopeCompletions, spanOf, typeAt, unaryOpsProducing, visibleNames };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { VarSchema, Schema, Schemes, TypeScheme, ObjectSchema, Completion } from './types/index.js';
2
- export { AnySchema, ApplySchema, ArraySchema, Bindings, DEFAULT_TYPE_LIMITS, Discovery, ElementFlag, FnSchema, GuardSig, INSTANTIATION_COUNT_LIMIT, INSTANTIATION_DEPTH_LIMIT, Incompatibility, IncompatibilityKind, IndexSchema, Instantiation, InstantiationLimitError, KeyofSchema, LiteralSchema, MappedSchema, OverloadSchema, Param, PathSegment, Prop, ScalarSchema, TYPE_EVAL_DEPTH_LIMIT, TupleSchema, TypeEvalLimitError, TypeEvalLimits, TypeForm, TypePosition, UnionSchema, UnionTooComplexError, UnknownSchema, VarCandidates, WriteKey, apparentType, asLiteralOrigin, baseLiteralType, bindTypeParams, comparable, configureTypeLimits, contravariantInference, covariantInference, discover, equals, erasedSignature, expand1, flagAt, format, formatTypeArgs, formatTypeDiff, freeVars, groundVars, inferFromCandidates, inferredTypes, instantiate, instantiateInContextOf, instantiateLoose, isMissingType, isNumericLiteralName, isObjectOrArrayLiteral, isScheme, isSerializable, isVariadicTuple, join, joinAll, missingType, normalizeUnion, ownProp, readonlyMember, renameTypeParams, resetInstantiationCount, resetTypeLimits, resolveConditional, resolveOp, resolveTypeOp, restIndex, restTypeAtPosition, s, sampleValue, silentNever, substitute, subtype, typeAtPosition, typeDiff, typeFeatures, typeLimits, typeNeedsParens, typeParamArity, unify, widen, widenInferred, widenLiteral, widenOrigin, widenType, withUndefined, withoutUndefined } from './types/index.js';
2
+ export { AnySchema, ApplySchema, ArraySchema, Bindings, DEFAULT_TYPE_LIMITS, Discovery, ElementFlag, FnSchema, GuardSig, INSTANTIATION_COUNT_LIMIT, INSTANTIATION_DEPTH_LIMIT, Incompatibility, IncompatibilityKind, IndexSchema, Instantiation, InstantiationLimitError, KeyofSchema, LiteralSchema, MappedSchema, OverloadSchema, Param, PathSegment, Prop, ScalarSchema, TYPE_EVAL_DEPTH_LIMIT, TupleSchema, TypeEvalLimitError, TypeEvalLimits, TypeForm, TypePosition, UnionSchema, UnionTooComplexError, UnknownSchema, VarCandidates, WriteKey, apparentType, asLiteralOrigin, baseLiteralType, bindTypeParams, comparable, configureTypeLimits, contravariantInference, covariantInference, discover, equals, erasedSignature, expand1, flagAt, format, formatTypeArgs, formatTypeDiff, freeVars, groundVars, inferFromCandidates, inferredTypes, instantiate, instantiateInContextOf, instantiateLoose, isMissingType, isNumericLiteralName, isObjectOrArrayLiteral, isScheme, isSerializable, isVariadicTuple, join, joinAll, missingType, normalizeUnion, ownProp, readonlyMember, renameTypeParams, resetInstantiationCount, resetTypeLimits, resolveConditional, resolveOp, resolveTypeOp, restIndex, restTypeAtPosition, s, sampleValue, silentNever, substitute, subtype, typeAtPosition, typeDiff, typeFeatures, typeLimits, typeNeedsParens, typeParamArity, unify, version, widen, widenInferred, widenLiteral, widenOrigin, widenType, withUndefined, withoutUndefined } from './types/index.js';
3
3
  import { Scope as Scope$1, BaseNode, Node, types, SourceLocation, Expression } from '@tslite/ast';
4
4
  import { CapabilityProfile, CompiledProfile } from '@tslite/capability';
5
5
  import { Span } from '@tslite/language-service';
@@ -139,7 +139,7 @@ declare const resolveNamed: (env: Env, name: string) => Schema | undefined;
139
139
  declare const resolveScheme: (env: Env, name: string) => TypeScheme | undefined;
140
140
 
141
141
  type Severity = "error" | "warning";
142
- type DiagnosticCode = "not-assignable" | "unknown-name" | "not-callable" | "no-such-member" | "not-object" | "possibly-nullish" | "unknown-value" | "const-needs-init" | "cannot-redeclare" | "circular-type-alias" | "circular-type-annotation" | "unknown-module" | "not-a-schema" | "type-as-value" | "asserter-needs-name" | "shadows-schema" | "missing-argument" | "excess-argument" | "excess-property" | "spread-argument" | "required-after-optional" | "not-iterable" | "not-spreadable" | "implicit-any" | "props-mismatch" | "no-matching-overload" | "constraint-violation" | "wrong-type-argument-count" | "unsupported" | "unused-name" | "assign-to-const" | "for-in-destructuring" | "readonly-write" | "cast-unsound" | "unprovable-value" | "not-arithmetic-operand" | "operator-not-applicable" | "implicit-coercion" | "node-not-allowed" | "name-not-allowed" | "type-feature-not-allowed" | "any-not-allowed" | "narrowing-cast-not-allowed" | "too-deep" | "too-complex-union" | "too-large" | "wrong-result-type";
142
+ type DiagnosticCode = "not-assignable" | "unknown-name" | "not-callable" | "no-such-member" | "not-object" | "possibly-nullish" | "unknown-value" | "const-needs-init" | "cannot-redeclare" | "circular-type-alias" | "circular-type-annotation" | "unknown-module" | "not-a-schema" | "type-as-value" | "asserter-needs-name" | "shadows-schema" | "missing-argument" | "excess-argument" | "excess-property" | "spread-argument" | "required-after-optional" | "not-iterable" | "not-spreadable" | "overwritten-property" | "implicit-any" | "props-mismatch" | "no-matching-overload" | "constraint-violation" | "wrong-type-argument-count" | "unsupported" | "unused-name" | "assign-to-const" | "for-in-destructuring" | "readonly-write" | "cast-unsound" | "unprovable-value" | "not-arithmetic-operand" | "operator-not-applicable" | "implicit-coercion" | "node-not-allowed" | "name-not-allowed" | "type-feature-not-allowed" | "any-not-allowed" | "narrowing-cast-not-allowed" | "too-deep" | "too-complex-union" | "too-large" | "wrong-result-type";
143
143
  /**
144
144
  * A **classe** do diagnóstico — espelha a divisão de passes do `tsc` (que nós
145
145
  * fundimos num walk só): `semantic` é o que o **binder** do tsc pega (validade do
@@ -187,6 +187,16 @@ type DiagnosticData = {
187
187
  readonly kind: "implicit-coercion";
188
188
  readonly textConvertible: boolean;
189
189
  };
190
+ /**
191
+ * Outro lugar do programa que explica o diagnóstico — o `DiagnosticRelatedInformation` do
192
+ * tsc (`types.ts`), que o `addRelatedInfo` anexa, e o `relatedInformation` do LSP. O nó é
193
+ * por referência, como o do diagnóstico; a mensagem diz o papel dele ("This spread always
194
+ * overwrites this property.").
195
+ */
196
+ interface DiagnosticRelatedInformation {
197
+ readonly node: BaseNode;
198
+ readonly message: string;
199
+ }
190
200
  interface Diagnostic {
191
201
  readonly code: DiagnosticCode;
192
202
  /** A classe do diagnóstico (deriva do `code`) — ver {@link DiagnosticKind}. */
@@ -197,6 +207,8 @@ interface Diagnostic {
197
207
  readonly message: string;
198
208
  /** Ver {@link DiagnosticData}. Presente só onde há o que agir. */
199
209
  readonly data?: DiagnosticData;
210
+ /** Ver {@link DiagnosticRelatedInformation}. Presente só onde o tsc a anexa. */
211
+ readonly relatedInformation?: readonly DiagnosticRelatedInformation[];
200
212
  }
201
213
  /**
202
214
  * Builder genérico de diagnóstico (severidade configurável). Usado pelos
@@ -265,12 +277,41 @@ declare const diag: {
265
277
  requiredAfterOptional: (node: BaseNode) => Diagnostic;
266
278
  notIterable: (node: BaseNode, type: Schema) => Diagnostic;
267
279
  /**
268
- * O rest de um padrão de objeto (`{ a, ...rest }`) sobre uma fonte que não é objeto — o
269
- * TS2700 do tsc, no elemento do rest (`getTypeForBindingElement`, `checker.ts:7439`: o
270
- * `isValidSpreadType` da fonte). O código é o do conceito — a fonte não se espalha —, par do
271
- * `not-iterable` do padrão de array.
280
+ * A fonte não se espalha: o `isValidSpreadType` do tsc (`checker.ts:23342`) a recusa. O
281
+ * código é o do conceito, par do `not-iterable` do padrão de array; a mensagem diz o caso.
282
+ */
283
+ notSpreadable: {
284
+ /** TS2700: o rest de um padrão de objeto (`{ a, ...rest }`), no elemento do rest
285
+ * (`getTypeForBindingElement`, `checker.ts:7439`). D80. */
286
+ rest: (node: BaseNode) => Diagnostic;
287
+ /** TS2698: o spread num literal de objeto (`{ ...x }`), no membro `...x`
288
+ * (`checkObjectLiteral`, `checker.ts:23254`). */
289
+ spread: (node: BaseNode) => Diagnostic;
290
+ };
291
+ /**
292
+ * A chave escrita duas vezes num literal de objeto. O tsc a acusa por três mecanismos, e
293
+ * cada um é um diagnóstico com o texto e o nó dele; o conceito é um só, o do
294
+ * `cannot-redeclare` (D25).
295
+ */
296
+ duplicateKey: {
297
+ /** TS1117: a chave IDENTIFICADOR repetida, no modo estrito (o `bindObjectLiteralExpression`
298
+ * do binder, `binder.ts:2037`), na repetição. */
299
+ strict: (node: BaseNode) => Diagnostic;
300
+ /** TS2300: o nome repetido (o `checkGrammarObjectLiteralExpression`), na repetição, com o
301
+ * texto do nome como escrito. */
302
+ identifier: (node: BaseNode, text: string) => Diagnostic;
303
+ /** TS2718: a chave computada ligada tarde com o nome de uma prop ligada cedo (o
304
+ * `lateBindMember`), na chave tardia. */
305
+ lateBound: (node: BaseNode, name: string) => Diagnostic;
306
+ /** TS2733: a primeira declaração ligada cedo desse nome, no mesmo `lateBindMember`. */
307
+ alsoDeclared: (node: BaseNode, name: string) => Diagnostic;
308
+ };
309
+ /**
310
+ * TS2783: a prop escrita num literal de objeto que um spread seguinte sempre sobrescreve,
311
+ * na prop escrita, com o spread na informação relacionada (TS2785) — o
312
+ * `checkSpreadPropOverrides` do tsc (`checker.ts:23558`).
272
313
  */
273
- notSpreadable: (node: BaseNode) => Diagnostic;
314
+ overwrittenProperty: (node: BaseNode, name: string, spread: BaseNode) => Diagnostic;
274
315
  /**
275
316
  * O `any` que ninguém escreveu — o `noImplicitAny` do tsc 3.9.10, que faz parte do
276
317
  * `--strict` e está sempre ligado aqui (D81). Um código só, com o texto de cada caso (o
@@ -399,11 +440,13 @@ declare const diag: {
399
440
  /**
400
441
  * Coletor de diagnósticos — acumula durante o walk, sem `throw`.
401
442
  *
402
- * Guarda cada diagnóstico UMA vez: um segundo com o mesmo nó, o mesmo código e a mesma
403
- * mensagem não entra. É a coleção do tsc (`createDiagnosticCollection`, que insere pelo
404
- * `insertSorted` e não repete o que o `compareDiagnostics` acha igual), e é o que deixa
405
- * um argumento ser tipado mais de uma vez — as rodadas da chamada (D53, D81) — sem que o
406
- * erro de dentro dele saia duas vezes.
443
+ * Guarda cada diagnóstico UMA vez: um segundo com o mesmo nó, o mesmo código, a mesma
444
+ * mensagem e a mesma informação relacionada não entra. É a coleção do tsc
445
+ * (`createDiagnosticCollection`, que insere pelo `insertSorted` e não repete o que o
446
+ * `compareDiagnostics` acha igual — ele compara também o `relatedInformation`), e é o que
447
+ * deixa um argumento ser tipado mais de uma vez — as rodadas da chamada (D53, D81) — sem
448
+ * que o erro de dentro dele saia duas vezes. Dois diagnósticos que só diferem na
449
+ * informação relacionada são dois: `{ a: 1, ...o1, ...o2 }` acusa o `a` uma vez por spread.
407
450
  */
408
451
  interface DiagnosticSink {
409
452
  /** Diagnósticos coletados, na ordem em que foram reportados, sem repetição. */
@@ -876,4 +919,4 @@ declare function anchorDiagnostics<A>(root: object, diagnostics: readonly Diagno
876
919
  */
877
920
  declare function spanOf(text: string, loc: SourceLocation | null | undefined): Span | undefined;
878
921
 
879
- export { type AnchorDiagnosticsOptions, type AnchoredDiagnostic, type Anchors, BINARY_OP, BINARY_OPS, type BinaryOpCategory, type BinaryOpSpec, type BindingMap, type CheckOptions, type CheckResult, type CheckerErrorCode, Completion, type Diagnostic, type DiagnosticCode, type DiagnosticData, type DiagnosticKind, type DiagnosticSink, type Env, type EnvOptions, FUNCTION_KINDS, type Guard, type GuardContext, LOGICAL_OPS, type LogicalOpSpec, type LowerValueOptions, type MissingProperty, type Nominals, ObjectSchema, type Occurrence, type OpResult, type Profile, type ReferenceSymbol, Schema, Schemes, type Scope, type Severity, type Shorthand, type TypeOverlay, type TypeRefSite, TypeScheme, UNARY_OPS, type UnaryOpSpec, type UnusedOptions, VarSchema, anchorDiagnostics, annotate, annotateReturn, asExpression, binaryOpsProducing, calleeAllowlist, capabilityNodes, check, childScope, collectBindings, collectMutations, collectReferences, collectUnused, componentProps, componentPropsOf, contextualTypeAt, createAnchors, createEnv, createSink, diag, diagnosticsAt, extractModuleType, fromCapability, guard, guardsFromCompiled, lookup, lowerValue, makeDiagnostic, maxArgs, maxCallNesting, maxDepth, maxFunctionNesting, maxNestingOf, maxNodes, memberCompletions, memberDepth, opResultSchema, resolveNamed, resolveScheme, resultType, rootScope, sameSymbol, scopeAt, scopeCompletions, spanOf, typeAt, unaryOpsProducing, visibleNames };
922
+ export { type AnchorDiagnosticsOptions, type AnchoredDiagnostic, type Anchors, BINARY_OP, BINARY_OPS, type BinaryOpCategory, type BinaryOpSpec, type BindingMap, type CheckOptions, type CheckResult, type CheckerErrorCode, Completion, type Diagnostic, type DiagnosticCode, type DiagnosticData, type DiagnosticKind, type DiagnosticRelatedInformation, type DiagnosticSink, type Env, type EnvOptions, FUNCTION_KINDS, type Guard, type GuardContext, LOGICAL_OPS, type LogicalOpSpec, type LowerValueOptions, type MissingProperty, type Nominals, ObjectSchema, type Occurrence, type OpResult, type Profile, type ReferenceSymbol, Schema, Schemes, type Scope, type Severity, type Shorthand, type TypeOverlay, type TypeRefSite, TypeScheme, UNARY_OPS, type UnaryOpSpec, type UnusedOptions, VarSchema, anchorDiagnostics, annotate, annotateReturn, asExpression, binaryOpsProducing, calleeAllowlist, capabilityNodes, check, childScope, collectBindings, collectMutations, collectReferences, collectUnused, componentProps, componentPropsOf, contextualTypeAt, createAnchors, createEnv, createSink, diag, diagnosticsAt, extractModuleType, fromCapability, guard, guardsFromCompiled, lookup, lowerValue, makeDiagnostic, maxArgs, maxCallNesting, maxDepth, maxFunctionNesting, maxNestingOf, maxNodes, memberCompletions, memberDepth, opResultSchema, resolveNamed, resolveScheme, resultType, rootScope, sameSymbol, scopeAt, scopeCompletions, spanOf, typeAt, unaryOpsProducing, visibleNames };