TypeScript wed/object-check assertExtensively示例

说明

typescript wed/object-check assertextensively示例是从最受好评的开源项目中提取的实现代码,你可以参考下面示例的使用方式。

编程语言: TypeScript

命名空间/包名称: wed/object-check

示例#1
文件: object-check-test.ts 项目: lddubeau/wed

 assert.throws(() => {
   assertExtensively(template, {
     bip: {
       toto: 1,
       unknown: 2,
     },
     toto: { blah: "blah" },
   });
 }, Error, "missing option: bar, extra option: bip.unknown");

示例#2
文件: object-check-test.ts 项目: lddubeau/wed

 it("does not throw on correct input", () => {
   assertExtensively(template, correct);
 });

展开阅读全文