Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: adjust missing props regex to work for private properties #106

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
`;