Skip to content

Commit

Permalink
WithDatey
Browse files Browse the repository at this point in the history
  • Loading branch information
ogroppo committed Feb 29, 2024
1 parent 215c7ca commit d1f67cc
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# deverything

## 0.46.0

### Minor Changes

- WithDatey

## 0.45.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "deverything",
"version": "0.45.0",
"version": "0.46.0",
"description": "Everything you need for Dev",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
Expand Down
23 changes: 23 additions & 0 deletions src/types/WithDatey.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { Datey } from "./Date";

export type WithDatey<T> = T extends Date
? Datey
: T extends Array<infer R>
? Array<WithDatey<R>>
: T extends object
? { [K in keyof T]: WithDatey<T[K]> }
: T;

// TEST
// type WithDates = {
// a: Date;
// b: {
// c: Date;
// c1: Date | null;
// c12: Date | undefined;
// c123: Date | undefined | null;
// };
// d: Date[];
// };

// type DateyDates = WithDatey<WithDates>;
1 change: 1 addition & 0 deletions src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ export * from "./Object";
export * from "./PlainObject";
export * from "./Point";
export * from "./PrismaSelect";
export * from "./WithDatey";

0 comments on commit d1f67cc

Please sign in to comment.