CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
sagemathinc

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/packages/util/fill/define.test.ts
Views: 687
1
/*
2
* This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.
3
* License: MS-RSL – see LICENSE.md for details
4
*/
5
6
import { define, required } from "./define";
7
import { expectType } from "tsd";
8
9
test("Defaulted value should be defined", () => {
10
interface Input {
11
foo: number;
12
bar: string;
13
baz?: string;
14
biz?: string;
15
}
16
interface Defaults {
17
baz: string;
18
}
19
const A = define<Input, Defaults>({ foo: 0, bar: "" }, {
20
foo: required,
21
bar: required,
22
baz: "defaulted",
23
});
24
25
expectType<string>(A.baz);
26
});
27
28