Strict check not working correctly for extended interfaces
mdesousa opened this issue · 4 comments
mdesousa commented
If you perform a strict check on an extended interface you will get an incorrect error about extraneous properties defined in the child interface.
See below sample code that illustrates the problem... the second test fails with an error: value.childProp is extraneous
import { createCheckers } from "ts-interface-checker";
import checkerTI from "./checker.test-ti";
const checkers = createCheckers(checkerTI);
interface IParent {
parentProp: string;
}
interface IChild extends IParent {
childProp: string;
}
describe("checker test", () => {
const value: IChild = {
parentProp: "parent value",
childProp: "child value",
};
it("check a value", async () => {
checkers.IChild.check(value); // passes
});
it("strict check a value", async () => {
checkers.IChild.strictCheck(value); // fails
});
});
dsagal commented
This seems a genuine bug, thanks for reporting!
RomRider commented
Same issue here. Seems like the additional attributes are undefined
while the checker is running.
RomRider commented
Thanks for the fix @dsagal! Any plan to release a version with those fixes included? 😊
dsagal commented
Will do this weekend!
…On Fri, Feb 19, 2021 at 11:30 AM Jérôme W. ***@***.***> wrote:
Thanks for the fix @dsagal <https://github.com/dsagal>! Any plan to
release a version with those fixes included? 😊
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#35 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAIKMRYEVK4IH6FY5IWAJLLS72GZNANCNFSM4V7LSQJA>
.