Skip to content

Commit

Permalink
adjust missing props regex to work for private properties (#106)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinramharak authored May 18, 2024
1 parent 2531440 commit b358fed
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/format/formatDiagnosticMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const formatDiagnosticMessage = (
)
// format missing props error
.replaceAll(
/(is missing the following properties from type\s?)'(.*)': ((?:\w+, )*(?:(?!and)\w+)?)/g,
/(is missing the following properties from type\s?)'(.*)': ((?:#?\w+, )*(?:(?!and)\w+)?)/g,
(_, pre, type, post) =>
`${pre}${formatTypeBlock("", type, format)}: <ul>${post
.split(", ")
Expand Down
7 changes: 6 additions & 1 deletion src/test/suite/errorMessageMocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const variableNotUsedEror = d`
const errorWithSimpleIndentations = d`
Type '(newIds: number[]) => void' is not assignable to type '(selectedId: string[]) => void'.
Types of parameters 'newIds' and 'selectedId' are incompatible.
Type 'string[]' is not assignable to type 'number[]'.
Type 'string[]' is not assignable to type 'number[]'.
Type 'string' is not assignable to type 'number'.
`;

Expand Down Expand Up @@ -94,3 +94,8 @@ Property 'a' is missing in type '{ b: { name: string; icon: undefined; }; c: { n
const errorWithStringChars = d`
Type '"' 'Oh no"' is not assignable to type '"' 'Oh n\"o\"' "'.
`;

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
`;

0 comments on commit b358fed

Please sign in to comment.