Are there type definitions in one of the Prisma pa...
# orm-help
m
Are there type definitions in one of the Prisma packages for the available scalar types in model fields and their valid attributes like
@unique
or
@default
? Example
@unique
not allowed on
@id
fields or
now()
not allowed on
String
fields?
r
@Marvin ๐Ÿ‘‹ Afaik you can get the types via
@prisma/client
directly, but I would need to check if thereโ€™s any for valid attributes for a given type.
So currently types can be imported like:
Copy code
import type {User} from '@prisma/client'
If you have a model named
User
.
Yeah I checked, this is only part of the parser and language server. I would like to know your use case for this though.
m
Hey Ryan! ๐Ÿ‘‹ I would like to create the schema programmatically and restrict the function arguments based on the scalar field type. I also have a definition for each scalar type (f.e.
String
,
Int
or
Boolean
) in a
const enum
. Just would be cool to already have the types from Prisma, so I don't need to manually stick them together with my own types (which are probably not 100% correct). ๐Ÿ™‚
r
Ohh, unfortunately you would only get the TypeScript types from Prisma and not any other constraints ๐Ÿ™‚