Skip to content

Commit

Permalink
Fix issue #82 - ts(4113), ts(4117)
Browse files Browse the repository at this point in the history
  • Loading branch information
yoavbls committed Jul 10, 2024
1 parent 9fdf2b8 commit d94370b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/format/formatDiagnosticMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export const formatDiagnosticMessage = (
)
// Format types
.replaceAll(
/(type|type alias|interface|module|file|file name|method's|subtype of constraint) ['“](.*?)['“](?=[\s(.|,)]|$)/gi,
/(type|type alias|interface|module|file|file name|class|method's|subtype of constraint) ['“](.*?)['“](?=[\s(.|,)]|$)/gi,
(_, p1: string, p2: string) => formatTypeBlock(p1, p2, format)
)
// Format reversed types
Expand All @@ -96,6 +96,6 @@ export const formatDiagnosticMessage = (
)
// Format regular code blocks
.replaceAll(
/(?<!.*?")(?:^|\s)['“]((?:(?!:\s*}).)*?)['“](?!\s*:)(?!.*?")/g,
/(?<!\w)'((?:(?!["]).)*?)'(?!\w)/g,
(_: string, p1: string) => ` ${unStyledCodeBlock(p1)} `
);
8 changes: 8 additions & 0 deletions src/test/suite/errorMessageMocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,11 @@ const ts2322ErrorWithPrivateProperty = d`
Type 'Ref<{ name: string; readonly type: "json"; mm: <T extends Convertible = Convertible>(px: T) => T; px: <T extends Convertible = Convertible>(mm: T) => T; ... 18 more ...; toJson: () => string; }>' is not assignable to type 'Ref<MpcdiConfiguration>'.
Type '{ name: string; readonly type: "json"; mm: <T extends Convertible = Convertible>(px: T) => T; px: <T extends Convertible = Convertible>(mm: T) => T; ... 18 more ...; toJson: () => string; }' is missing the following properties from type 'MpcdiConfiguration': ratio, #overlaps, download
`;

const ts4113Error = d`
This member cannot have an 'override' modifier because it is not declared in the base class 'A<T["nested"]>'.
`;

const ts4117Error = d`
This member cannot have an 'override' modifier because it is not declared in the base class 'A<T["nested"]>'. Did you mean 'testA'?
`;

0 comments on commit d94370b

Please sign in to comment.