Skip to content

Commit

Permalink
bump package version
Browse files Browse the repository at this point in the history
  • Loading branch information
abrantesarthur committed Jan 19, 2025
1 parent 46a8917 commit 809014f
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"author": "Transcend Inc.",
"name": "@transcend-io/type-utils",
"description": "Small package containing useful typescript utilities.",
"version": "1.8.2",
"version": "1.8.3",
"homepage": "https://github.com/transcend-io/type-utils",
"repository": {
"type": "git",
Expand Down
6 changes: 0 additions & 6 deletions src/codecTools/createDefaultCodec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,8 @@ import * as t from 'io-ts';
export const createDefaultCodec = <C extends t.Mixed>(
codec: C,
): t.TypeOf<C> => {
console.log({codecName: codec.name})
// If the codec is an union
if (codec instanceof t.UnionType) {
console.log("union type")
// The default for a union containing arrays is a default array
const arrayType = codec.types.find(
(type: any) => type instanceof t.ArrayType,
Expand All @@ -62,7 +60,6 @@ export const createDefaultCodec = <C extends t.Mixed>(
type instanceof t.ArrayType,
);
if (objectType) {
console.log("objectType")
return createDefaultCodec(objectType);
}

Expand All @@ -71,7 +68,6 @@ export const createDefaultCodec = <C extends t.Mixed>(
(type: any) => type instanceof t.NullType || type.name === 'null',
);
if (hasNull) {
console.log("hasNull")
return null as t.TypeOf<C>;
}

Expand Down Expand Up @@ -117,13 +113,11 @@ export const createDefaultCodec = <C extends t.Mixed>(

// The default of a literal type is its value
if (codec instanceof t.LiteralType) {
console.log(codec.name);
return codec.value as t.TypeOf<C>;
}

// The default of an object type is an empty object
if (codec instanceof t.ObjectType) {
console.log(codec.name);
return {} as t.TypeOf<C>;
}

Expand Down

0 comments on commit 809014f

Please sign in to comment.