@junoscript/juno 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -23,7 +23,10 @@ function printType(type, generics) {
23
23
  case 'UnionType': return `(${type.types.map(part => printType(part, generics)).join(' | ')})`;
24
24
  case 'IntersectionType': return `(${type.types.map(part => printType(part, generics)).join(' & ')})`;
25
25
  case 'FunctionType': {
26
- const parameters = type.params.map((param, index) => `${type.paramNames?.[index] ?? `arg${index}`}: ${printType(param, generics)}`);
26
+ const parameters = type.params.map((param, index) => {
27
+ const optional = type.optionalFrom !== undefined && index >= type.optionalFrom;
28
+ return `${type.paramNames?.[index] ?? `arg${index}`}${optional ? '?' : ''}: ${printType(param, generics)}`;
29
+ });
27
30
  if (type.rest)
28
31
  parameters.push(`...${type.restName ?? 'args'}: ${printType(type.rest, generics)}`);
29
32
  const genericParameters = type.genericParameters?.map(({ name, constraint, defaultType }) => `${name}${constraint ? ` extends ${printType(constraint, generics)}` : ''}${defaultType ? ` = ${printType(defaultType, generics)}` : ''}`);
@@ -5,26 +5,52 @@ const interpreter_js_1 = require("../Runtime/interpreter.js");
5
5
  const build_juno_js_1 = require("./build-juno.js");
6
6
  const args = process.argv.slice(2);
7
7
  const build = args[0] === '--build';
8
- const file = args[build ? 1 : 0];
9
- if (!file || file === '--help' || file === '-h') {
10
- console.log('Usage:\n junode <file.jn> [args...]\n junode --build <file.jn> [--out <file.js|file.ts>] [--target js|ts]');
11
- process.exit(file ? 0 : 2);
8
+ const [command, firstBuildArgument] = args;
9
+ const help = build ? firstBuildArgument : command;
10
+ const usage = 'Usage:\n junode <file.jn> [args...]\n junode --build [--ts] <filename> [-o <outputfilename>]';
11
+ if (!help || help === '--help' || help === '-h') {
12
+ console.log(usage);
13
+ process.exit(help ? 0 : 2);
12
14
  }
13
15
  try {
14
16
  if (build) {
15
- const outIndex = args.indexOf('--out');
16
- const targetIndex = args.indexOf('--target');
17
- const target = targetIndex >= 0 ? args[targetIndex + 1] : undefined;
18
- if (target !== undefined && target !== 'js' && target !== 'ts')
19
- throw new Error("--target must be 'js' or 'ts'");
20
- const output = (0, build_juno_js_1.buildJunoFile)(file, {
21
- outFile: outIndex >= 0 ? args[outIndex + 1] : undefined,
22
- target: target
23
- });
17
+ let file;
18
+ let outFile;
19
+ let target;
20
+ for (let index = 1; index < args.length; index++) {
21
+ const arg = args[index];
22
+ if (arg === '--ts' || arg === '--target') {
23
+ const format = arg === '--ts' ? 'ts' : args[++index];
24
+ if (format !== 'js' && format !== 'ts')
25
+ throw new Error("--target must be 'js' or 'ts'");
26
+ if (target && target !== format)
27
+ throw new Error('Conflicting build targets');
28
+ target = format;
29
+ }
30
+ else if (arg === '-o' || arg === '--out') {
31
+ const path = args[++index];
32
+ if (!path || path.startsWith('-'))
33
+ throw new Error(`${arg} requires an output filename`);
34
+ if (outFile !== undefined)
35
+ throw new Error('Specify only one output filename');
36
+ outFile = path;
37
+ }
38
+ else if (arg.startsWith('-')) {
39
+ throw new Error(`Unknown build option: ${arg}`);
40
+ }
41
+ else {
42
+ if (file)
43
+ throw new Error('Specify only one input filename');
44
+ file = arg;
45
+ }
46
+ }
47
+ if (!file)
48
+ throw new Error('Missing input filename');
49
+ const output = (0, build_juno_js_1.buildJunoFile)(file, { outFile, target });
24
50
  console.log(output);
25
51
  }
26
52
  else
27
- (0, interpreter_js_1.runFile)(file);
53
+ (0, interpreter_js_1.runFile)(command);
28
54
  }
29
55
  catch (error) {
30
56
  console.error(error instanceof Error ? error.stack ?? error.message : error);
@@ -3,6 +3,13 @@ export type Loc = {
3
3
  line: number;
4
4
  column: number;
5
5
  };
6
+ export declare function indexedTypeQuery(expression: Expression): (Extract<TypeNode, {
7
+ kind: 'IndexedAccessType';
8
+ }> & {
9
+ object: Extract<TypeNode, {
10
+ kind: 'NamedType';
11
+ }>;
12
+ }) | undefined;
6
13
  export type TypeNode = {
7
14
  kind: 'NamedType';
8
15
  name: string;
@@ -45,6 +52,7 @@ export type TypeNode = {
45
52
  kind: 'FunctionType';
46
53
  params: TypeNode[];
47
54
  paramNames?: (string | undefined)[];
55
+ optionalFrom?: number;
48
56
  rest?: TypeNode;
49
57
  restName?: string;
50
58
  genericParameters?: GenericParameter[];
@@ -1,8 +1,22 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Parser = void 0;
4
+ exports.indexedTypeQuery = indexedTypeQuery;
4
5
  exports.parse = parse;
5
6
  const lexer_1 = require("./lexer");
7
+ function indexedTypeQuery(expression) {
8
+ if (expression.kind !== 'Index' || expression.object.kind !== 'Identifier' || expression.index.kind !== 'Literal')
9
+ return;
10
+ const value = expression.index.value;
11
+ if (typeof value !== 'string' && typeof value !== 'number')
12
+ return;
13
+ return {
14
+ kind: 'IndexedAccessType',
15
+ object: { kind: 'NamedType', name: expression.object.name, loc: expression.object.loc },
16
+ index: { kind: 'LiteralType', value, loc: expression.index.loc },
17
+ loc: expression.loc
18
+ };
19
+ }
6
20
  const precedence = { '|': 1, '&': 2, '??': 3, '==': 4, '!=': 4, '<': 5, '<=': 5, '>': 5, '>=': 5, '+': 6, '-': 6, '*': 7, '/': 7, '%': 7 };
7
21
  const opTypes = { EqualEqual: '==', NotEqual: '!=', Less: '<', LessEqual: '<=', Greater: '>', GreaterEqual: '>=', Nullish: '??', Pipe: '|', Ampersand: '&', Plus: '+', Minus: '-', Multiply: '*', Divide: '/', Percent: '%' };
8
22
  const assignmentOperators = { Equal: '=', PlusEqual: '+=', MinusEqual: '-=', MultiplyEqual: '*=', DivideEqual: '/=', PercentEqual: '%=', PipeEqual: '|=', AmpersandEqual: '&=' };
@@ -354,7 +368,12 @@ class Parser {
354
368
  this.pos += ellipsis ? 1 : 3;
355
369
  if (restSeen)
356
370
  this.fail('A rest parameter must be the last parameter');
357
- const { name, loc } = this.identifier(), type = this.match('Colon') ? this.type() : undefined, defaultValue = this.match('Equal') ? this.expression() : undefined;
371
+ const { name, loc } = this.identifier();
372
+ const optional = this.match('Question');
373
+ if (optional)
374
+ this.take('Colon', "Expected ':' after optional parameter name");
375
+ const type = optional || this.match('Colon') ? this.type() : undefined;
376
+ const defaultValue = this.match('Equal') ? this.expression() : optional ? { kind: 'Literal', value: null } : undefined;
358
377
  if (rest && defaultValue !== undefined)
359
378
  this.fail('A rest parameter cannot have a default value');
360
379
  if (rest && !type)
@@ -423,10 +442,13 @@ class Parser {
423
442
  if (this.match('Identifier', 'is')) {
424
443
  const token = this.tokens[this.pos - 1];
425
444
  const target = this.type(true);
426
- if (left.kind !== 'NamedType' || target.kind !== 'NamedType')
427
- this.fail("'is' type operands must be type names");
428
445
  if (this.match('Question')) {
429
446
  const consequent = this.type();
447
+ let colon = this.pos;
448
+ while (this.tokens[colon]?.type === 'Newline' || this.tokens[colon]?.type === 'Indent')
449
+ colon++;
450
+ if (this.tokens[colon]?.type === 'Colon')
451
+ this.pos = colon;
430
452
  this.take('Colon', "Expected ':' in conditional type");
431
453
  return { kind: 'ConditionalType', check: left, target, consequent, alternate: this.type(), loc: this.loc(token) };
432
454
  }
@@ -472,9 +494,10 @@ class Parser {
472
494
  this.take('Colon', "Expected ':' after index parameter");
473
495
  const indexType = this.type();
474
496
  this.take('RightBracket', "Expected ']' after index parameter type");
497
+ const optional = this.match('Question');
475
498
  this.take('Colon', "Expected ':' before indexed value type");
476
499
  const valueType = this.type();
477
- members.push({ name: key.name, loc: key.loc, type: valueType, indexType, optional: false, readonly: false, constant: false });
500
+ members.push({ name: key.name, loc: key.loc, type: valueType, indexType, optional, readonly: false, constant: false });
478
501
  this.objectSeparators();
479
502
  continue;
480
503
  }
@@ -540,12 +563,15 @@ class Parser {
540
563
  this.take('RightBrace');
541
564
  result = { kind: 'ObjectType', members };
542
565
  }
543
- else if (this.is('Keyword', 'fun') || this.is('LeftParen')) {
566
+ else if (this.is('Keyword', 'fun') || this.is('LeftParen') || this.is('Less')) {
544
567
  const explicitFunction = this.match('Keyword', 'fun');
545
- const genericParameters = explicitFunction && this.match('Less') ? this.genericParameters() : undefined;
568
+ const genericParameters = this.match('Less') ? this.genericParameters() : undefined;
546
569
  this.take('LeftParen', "Expected '(' in function type");
570
+ const contentStart = this.pos;
547
571
  const args = [];
548
572
  const paramNames = [];
573
+ const optionalParams = [];
574
+ let lastRequired = -1;
549
575
  let rest;
550
576
  let restName;
551
577
  if (!this.is('RightParen'))
@@ -554,25 +580,48 @@ class Parser {
554
580
  this.fail('A rest parameter must be the last parameter');
555
581
  const variadic = this.match('Ellipsis');
556
582
  let name;
557
- if (this.is('Identifier') && this.tokens[this.pos + 1]?.type === 'Colon') {
583
+ let optional = false;
584
+ if (this.is('Identifier') && (this.tokens[this.pos + 1]?.type === 'Colon' ||
585
+ this.tokens[this.pos + 1]?.type === 'Question' && this.tokens[this.pos + 2]?.type === 'Colon')) {
558
586
  name = this.identifier().name;
587
+ optional = this.match('Question');
559
588
  this.take('Colon');
560
589
  }
561
590
  const argument = this.type();
562
591
  if (variadic) {
592
+ if (optional)
593
+ this.fail('A rest parameter cannot be optional');
563
594
  rest = argument;
564
595
  restName = name;
565
596
  }
566
597
  else {
598
+ if (!optional)
599
+ lastRequired = args.length;
567
600
  args.push(argument);
601
+ optionalParams.push(optional);
568
602
  paramNames.push(name);
569
603
  }
570
604
  } while (this.match('Comma'));
605
+ let openIndents = 0;
606
+ for (let index = contentStart; index < this.pos; index++) {
607
+ if (this.tokens[index].type === 'Indent')
608
+ openIndents++;
609
+ if (this.tokens[index].type === 'Dedent')
610
+ openIndents--;
611
+ }
612
+ while (this.match('Newline') || openIndents > 0 && this.match('Dedent')) {
613
+ if (this.tokens[this.pos - 1].type === 'Dedent')
614
+ openIndents--;
615
+ }
571
616
  this.take('RightParen');
572
617
  if (this.match('Arrow') || this.match('FatArrow')) {
573
- result = { kind: 'FunctionType', params: args, paramNames, rest, restName, genericParameters, result: this.type() };
618
+ const params = args.map((arg, index) => optionalParams[index] && index < lastRequired
619
+ ? { kind: 'UnionType', types: [arg, { kind: 'NamedType', name: 'undefined' }] }
620
+ : arg);
621
+ const optionalFrom = lastRequired + 1 < args.length ? lastRequired + 1 : undefined;
622
+ result = { kind: 'FunctionType', params, paramNames, optionalFrom, rest, restName, genericParameters, result: this.type() };
574
623
  }
575
- else if (!explicitFunction && !rest && args.length === 1)
624
+ else if (!explicitFunction && !genericParameters && !rest && args.length === 1)
576
625
  result = args[0];
577
626
  else
578
627
  this.fail('Expected function return type after -> or =>');
@@ -0,0 +1,15 @@
1
+ import { Buffer as NodeBuffer } from 'node:buffer';
2
+ export type Encoding = BufferEncoding;
3
+ export declare const encodings: readonly ["utf8", "utf-8", "utf16le", "utf-16le", "ucs2", "ucs-2", "ascii", "latin1", "binary", "base64", "base64url", "hex"];
4
+ declare function createUint8Array(input?: number | ArrayLike<number> | ArrayBufferLike, byteOffset?: number, length?: number): Uint8Array;
5
+ declare function bufferFrom<T>(input: T, encoding?: Encoding): NodeBuffer;
6
+ export declare const Uint8ArrayConstructor: typeof createUint8Array & {
7
+ from: (input: ArrayLike<number>) => Uint8Array<ArrayBuffer>;
8
+ of: (...bytes: number[]) => Uint8Array<ArrayBuffer>;
9
+ };
10
+ export declare const BufferConstructor: ((input?: number | string | ArrayLike<number>, encoding?: Encoding) => NodeBuffer<ArrayBufferLike>) & {
11
+ from: typeof bufferFrom;
12
+ alloc: (size: number, fill?: string | Uint8Array | number, encoding?: BufferEncoding) => Buffer<ArrayBuffer>;
13
+ isBuffer: (obj: any) => obj is Buffer;
14
+ };
15
+ export {};
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BufferConstructor = exports.Uint8ArrayConstructor = exports.encodings = void 0;
4
+ const node_buffer_1 = require("node:buffer");
5
+ exports.encodings = ['utf8', 'utf-8', 'utf16le', 'utf-16le', 'ucs2', 'ucs-2', 'ascii', 'latin1', 'binary', 'base64', 'base64url', 'hex'];
6
+ function createUint8Array(input = 0, byteOffset, length) {
7
+ if (typeof input === 'number')
8
+ return new Uint8Array(input);
9
+ if (input instanceof ArrayBuffer || input instanceof SharedArrayBuffer)
10
+ return new Uint8Array(input, byteOffset, length);
11
+ return new Uint8Array(input);
12
+ }
13
+ function bufferFrom(input, encoding = 'utf8') {
14
+ if (typeof input === 'string')
15
+ return node_buffer_1.Buffer.from(input, encoding);
16
+ if (input instanceof ArrayBuffer || input instanceof SharedArrayBuffer)
17
+ return node_buffer_1.Buffer.from(input);
18
+ if (Array.isArray(input) || input instanceof Uint8Array)
19
+ return node_buffer_1.Buffer.from(input);
20
+ if (input !== null && typeof input === 'object' && 'length' in input && typeof input.length === 'number') {
21
+ return node_buffer_1.Buffer.from(input);
22
+ }
23
+ if (!['utf8', 'utf-8', 'utf16le', 'utf-16le', 'ucs2', 'ucs-2', 'ascii', 'latin1', 'binary'].includes(encoding)) {
24
+ throw new TypeError('Serializing a value to Buffer requires a text encoding');
25
+ }
26
+ const json = JSON.stringify(input);
27
+ if (json === undefined)
28
+ throw new TypeError('Buffer.from requires bytes, text, or a JSON-serializable value');
29
+ return node_buffer_1.Buffer.from(json, encoding);
30
+ }
31
+ exports.Uint8ArrayConstructor = Object.assign(createUint8Array, {
32
+ from: (input) => Uint8Array.from(input),
33
+ of: (...bytes) => Uint8Array.of(...bytes)
34
+ });
35
+ exports.BufferConstructor = Object.assign((input = 0, encoding) => typeof input === 'number' ? node_buffer_1.Buffer.alloc(input) : bufferFrom(input, encoding), { from: bufferFrom, alloc: node_buffer_1.Buffer.alloc, isBuffer: node_buffer_1.Buffer.isBuffer });
@@ -1,5 +1,7 @@
1
1
  export type { Awaited, ConstructorParameters, Exclude, Extract, InstanceType, KeyOf, NonNullable, Omit, OmitThisParameter, Parameters, Partial, Pick, Readonly, Record, Required, ReturnType, ThisParameterType, ThisType } from './types';
2
- export { Range } from './juno';
2
+ export { Buffer, Range, Uint8Array } from './juno';
3
+ export { Date } from './types';
4
+ export type { Encoding } from './bytes';
3
5
  export type { Error } from './juno';
4
6
  export type { Iterable } from './juno-types';
5
7
  /** Runtime module table used to resolve JunoScript import specifiers. */
@@ -77,6 +79,8 @@ export declare const modules: {
77
79
  typeNode?: import("../Lexer/parser").TypeNode;
78
80
  };
79
81
  Items: () => (string | number)[];
82
+ Keys: () => (string | number)[];
83
+ Date: typeof import("./types").Date;
80
84
  };
81
85
  readonly 'juno:async': {
82
86
  Promise: PromiseConstructor;
@@ -189,6 +193,8 @@ export declare const modules: {
189
193
  typeNode?: import("../Lexer/parser").TypeNode;
190
194
  };
191
195
  Items: () => (string | number)[];
196
+ Keys: () => (string | number)[];
197
+ Date: typeof import("./types").Date;
192
198
  };
193
199
  };
194
200
  export type ModuleName = keyof typeof modules;
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.modules = exports.Range = void 0;
6
+ exports.modules = exports.Date = exports.Uint8Array = exports.Range = exports.Buffer = void 0;
7
7
  exports.resolveModule = resolveModule;
8
8
  const juno_1 = __importDefault(require("./juno"));
9
9
  const juno_node_1 = __importDefault(require("./juno-node"));
@@ -12,7 +12,11 @@ const async_1 = __importDefault(require("./async"));
12
12
  const juno_node_fs_1 = __importDefault(require("./juno-node-fs"));
13
13
  const juno_test_1 = __importDefault(require("./juno-test"));
14
14
  var juno_2 = require("./juno");
15
+ Object.defineProperty(exports, "Buffer", { enumerable: true, get: function () { return juno_2.Buffer; } });
15
16
  Object.defineProperty(exports, "Range", { enumerable: true, get: function () { return juno_2.Range; } });
17
+ Object.defineProperty(exports, "Uint8Array", { enumerable: true, get: function () { return juno_2.Uint8Array; } });
18
+ var types_2 = require("./types");
19
+ Object.defineProperty(exports, "Date", { enumerable: true, get: function () { return types_2.Date; } });
16
20
  /** Runtime module table used to resolve JunoScript import specifiers. */
17
21
  exports.modules = {
18
22
  juno: juno_1.default,
@@ -1,6 +1,9 @@
1
1
  /** Standard JunoScript console module; mirrors the JavaScript/TypeScript console. */
2
2
  import { types } from './types';
3
3
  import type { Iterable } from './juno-types';
4
+ import { BufferConstructor, Uint8ArrayConstructor } from './bytes';
5
+ export { BufferConstructor as Buffer, Uint8ArrayConstructor as Uint8Array };
6
+ export type { Encoding } from './bytes';
4
7
  export declare const console: Console;
5
8
  export { types };
6
9
  export type { Iterable } from './juno-types';
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.types = exports.console = void 0;
3
+ exports.types = exports.console = exports.Uint8Array = exports.Buffer = void 0;
4
4
  exports.Range = Range;
5
5
  /** Standard JunoScript console module; mirrors the JavaScript/TypeScript console. */
6
6
  const types_1 = require("./types");
@@ -9,6 +9,9 @@ const node_fs_1 = require("node:fs");
9
9
  const node_path_1 = require("node:path");
10
10
  const lexer_1 = require("../Lexer/lexer");
11
11
  const parser_1 = require("../Lexer/parser");
12
+ const bytes_1 = require("./bytes");
13
+ Object.defineProperty(exports, "Buffer", { enumerable: true, get: function () { return bytes_1.BufferConstructor; } });
14
+ Object.defineProperty(exports, "Uint8Array", { enumerable: true, get: function () { return bytes_1.Uint8ArrayConstructor; } });
12
15
  exports.console = globalThis.console;
13
16
  /** TypeScript entry point matching the JunoScript Range constructor. */
14
17
  function Range(start, end, step = 1) {
@@ -45,6 +48,8 @@ Object.defineProperties(JunoMath, {
45
48
  });
46
49
  const juno = {
47
50
  console: exports.console,
51
+ Buffer: bytes_1.BufferConstructor,
52
+ Uint8Array: bytes_1.Uint8ArrayConstructor,
48
53
  Math: JunoMath,
49
54
  types: types_1.types,
50
55
  Error,
@@ -72,5 +77,8 @@ for (const [name, alias] of Object.entries(junoTypes))
72
77
  typeNode: alias.value,
73
78
  generics: alias.generics
74
79
  };
75
- Object.defineProperty(juno, '__junoTypes', { value: junoTypes, enumerable: false });
80
+ Object.defineProperty(juno, '__junoTypes', {
81
+ value: { ...junoTypes, Encoding: { value: { kind: 'UnionType', types: bytes_1.encodings.map(value => ({ kind: 'LiteralType', value })) }, generics: [] } },
82
+ enumerable: false
83
+ });
76
84
  exports.default = juno;
@@ -43,6 +43,9 @@ export declare const Exclude: (input: unknown, excluded: unknown) => RuntimeType
43
43
  export declare const Pick: (input: unknown, keys: unknown) => RuntimeTypeInput;
44
44
  export declare const Omit: (input: unknown, keys: unknown) => RuntimeTypeInput;
45
45
  export declare const Items: () => (string | number)[];
46
+ export declare const Keys: () => (string | number)[];
47
+ declare function createDate(value?: string | number | Date): Date;
48
+ export { createDate as Date };
46
49
  export declare const types: {
47
50
  Partial: (input: unknown) => RuntimeTypeInput;
48
51
  Required: (input: unknown) => RuntimeTypeInput;
@@ -52,5 +55,7 @@ export declare const types: {
52
55
  KeyOf: (input: unknown) => RuntimeTypeInput;
53
56
  Exclude: (input: unknown, excluded: unknown) => RuntimeTypeInput;
54
57
  Items: () => (string | number)[];
58
+ Keys: () => (string | number)[];
59
+ Date: typeof createDate;
55
60
  };
56
61
  export default types;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.types = exports.Items = exports.Omit = exports.Pick = exports.Exclude = exports.KeyOf = exports.Readonly = exports.Required = exports.Partial = void 0;
3
+ exports.types = exports.Keys = exports.Items = exports.Omit = exports.Pick = exports.Exclude = exports.KeyOf = exports.Readonly = exports.Required = exports.Partial = void 0;
4
+ exports.Date = createDate;
4
5
  function typeNodeOf(input) {
5
6
  const node = input?.typeNode;
6
7
  if (node && typeof node === 'object' && 'kind' in node)
@@ -83,5 +84,12 @@ exports.Omit = Omit;
83
84
  // The interpreter materializes Items<T>() from its compile-time literal type argument.
84
85
  const Items = () => [];
85
86
  exports.Items = Items;
86
- exports.types = { Partial: exports.Partial, Required: exports.Required, Readonly: exports.Readonly, Pick: exports.Pick, Omit: exports.Omit, KeyOf: exports.KeyOf, Exclude: exports.Exclude, Items: exports.Items };
87
+ const Keys = () => [];
88
+ exports.Keys = Keys;
89
+ function createDate(value) {
90
+ if (value === undefined)
91
+ return new Date();
92
+ return new Date(value instanceof Date ? value.getTime() : value);
93
+ }
94
+ exports.types = { Partial: exports.Partial, Required: exports.Required, Readonly: exports.Readonly, Pick: exports.Pick, Omit: exports.Omit, KeyOf: exports.KeyOf, Exclude: exports.Exclude, Items: exports.Items, Keys: exports.Keys, Date: createDate };
87
95
  exports.default = exports.types;