CipherStash Docs
StackLatestSchemaType aliases

InferPlaintext

Infer the plaintext (decrypted) type from a EncryptedTable schema.

@cipherstash/stack


Type Alias: InferPlaintext<T>

type InferPlaintext&lt;T&gt; = T extends EncryptedTable&lt;infer C&gt; ? { [K in keyof C as C[K] extends EncryptedColumn | EncryptedField ? K : never]: string } : never;

Defined in: .tmp-stack/packages/stack/src/schema/index.ts:464

Infer the plaintext (decrypted) type from a EncryptedTable schema.

Type Parameters

T

T extends EncryptedTable<any>

Example

const users = encryptedTable("users", {
  email: encryptedColumn("email").equality(),
  name: encryptedColumn("name"),
})

type UserPlaintext = InferPlaintext&lt;typeof users&gt;
// => { email: string; name: string }

On this page