TypeScript/tests/cases/compiler/assignmentCompatFunctionsWithOptionalArgs.ts
2014-07-12 17:30:19 -07:00

5 lines
273 B
TypeScript

function foo(x: { id: number; name?: string; }): void;
foo({ id: 1234 }); // Ok
foo({ id: 1234, name: "hello" }); // Ok
foo({ id: 1234, name: false }); // Error, name of wrong type
foo({ name: "hello" }); // Error, id required but missing