Skip to content

Commit

Permalink
Add ts18046 to known errors (#211)
Browse files Browse the repository at this point in the history
  • Loading branch information
tommy-mitchell authored Feb 24, 2024
1 parent e27e031 commit 700679e
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions source/lib/compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ const expectErrorDiagnosticCodesToIgnore = new Set<DiagnosticCode>([
DiagnosticCode.RuntimeWillInvokeDecoratorWithXArgumentsButDecoratorExpectsAtLeastY,
DiagnosticCode.AcceptsTooFewArgumentsToBeUsedAsDecoratorHere,
DiagnosticCode.PropertyDoesNotExistOnTypeDidYouMean,
DiagnosticCode.ErrorIsOfTypeUnknown,
]);

type IgnoreDiagnosticResult = 'preserve' | 'ignore' | Location;
Expand Down
1 change: 1 addition & 0 deletions source/lib/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export enum DiagnosticCode {
MemberCannotHaveOverrideModifierBecauseItIsNotDeclaredInBaseClass = 4113,
MemberMustHaveOverrideModifier = 4114,
NewExpressionTargetLackingConstructSignatureHasAnyType = 7009,
ErrorIsOfTypeUnknown = 18046,
}

export interface Diagnostic {
Expand Down
4 changes: 3 additions & 1 deletion source/test/fixtures/expect-error/values/index.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ try {
expectError(foo.bar = 'quux');
expectError(foo.quux);
}
} catch {}
} catch (error) {
expectError(error.code);
}

expectError(hasProperty({name: 1}));

Expand Down
7 changes: 6 additions & 1 deletion source/test/fixtures/expect-error/values/package.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
{
"name": "foo"
"name": "foo",
"tsd": {
"compilerOptions": {
"useUnknownInCatchVariables": true
}
}
}

0 comments on commit 700679e

Please sign in to comment.