Skip to content

Commit

Permalink
fix: types
Browse files Browse the repository at this point in the history
  • Loading branch information
theo committed Dec 7, 2021
1 parent 999905a commit f4a8156
Show file tree
Hide file tree
Showing 2 changed files with 1,452 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/transformer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export class EncryptionTransformer implements ValueTransformer {
export class JSONEncryptionTransformer implements ValueTransformer {
constructor(private options: EncryptionOptions) {}

public from(value?: string | null | object): string | undefined {
public from(value?: string | null | object): Object | undefined {
if (!value) {
return;
}
Expand All @@ -72,12 +72,12 @@ export class JSONEncryptionTransformer implements ValueTransformer {
return JSON.parse(decrypted);
}

public to(value?: string | FindOperator<any> | null): string | FindOperator<any> | undefined {
public to(value?: any | FindOperator<any> | null): string | FindOperator<any> | undefined {
if ((value ?? null) === null) {
return;
}

if (typeof value === 'object' && !value.type) {
if (typeof value === 'object' && !value?.type) {
return encryptData(
Buffer.from(JSON.stringify(value) as string, 'utf8'),
this.options
Expand Down
Loading

0 comments on commit f4a8156

Please sign in to comment.