Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Synopsis
- getPrintedDefinition :: forall a. TypeScriptDefinition a => Proxy a -> String
- printTS :: TSType -> String
- class FieldTypeName a where
- fieldTypeName :: Proxy a -> FieldSpec
- class TypeScriptDefinition a where
- data FieldSpec = FieldSpec {
- fs_type :: !FieldType
- fs_wrapped :: !String
- fs_unwrapped :: !String
- data FieldType
- data IsNewtype
- data TSField = TSField {}
- data TSGenericVar s
- data TSInterface = TSInterface {
- tsi_constructor :: !String
- tsi_typeName :: !(Maybe String)
- tsi_members :: ![TSField]
- data TSType = TSType {
- tst_constructor :: !String
- tst_doc :: !String
- tst_interfaces :: !(NonEmpty TSInterface)
- tst_newtype :: !IsNewtype
- concretely :: String -> FieldSpec
- genericly :: String -> FieldSpec
Primary generation functions
getPrintedDefinition :: forall a. TypeScriptDefinition a => Proxy a -> String Source #
Get the TypeScriptDefinition as a String
Type Classes
class FieldTypeName a where Source #
Typeclass to determine the FieldSpec from a payload's type
fieldTypeName :: Proxy a -> FieldSpec Source #
Instances
class TypeScriptDefinition a where Source #
This typeclass provides the ability to derive a TSType from any Generic data type
Nothing
Instances
(TypeError (('Text "No instance of TypeScriptDefinition found for: " ':<>: 'ShowType a) ':$$: 'Text "\128160 If you are seeing this for a newtype of something primitive, derive FieldTypeName instead.") :: Constraint) => TypeScriptDefinition a Source # | Custom error for missing TypeScriptDefinition's, as they can be a red herring |
Defined in Data.Aeson.Generics.TypeScript |
TypeScript AST data types
Helper for printing fields
FieldSpec | |
|
Fields can be concrete types, or generic type variables
Instances
Semigroup FieldType Source # | |
Bounded FieldType Source # | |
Enum FieldType Source # | |
Defined in Data.Aeson.Generics.TypeScript succ :: FieldType -> FieldType # pred :: FieldType -> FieldType # fromEnum :: FieldType -> Int # enumFrom :: FieldType -> [FieldType] # enumFromThen :: FieldType -> FieldType -> [FieldType] # enumFromTo :: FieldType -> FieldType -> [FieldType] # enumFromThenTo :: FieldType -> FieldType -> FieldType -> [FieldType] # | |
Show FieldType Source # | |
Eq FieldType Source # | |
Ord FieldType Source # | |
Defined in Data.Aeson.Generics.TypeScript |
Determine if this is a newtype and will not be wrapped
A field within a term constructor
data TSGenericVar s Source #
Type level rep of a named generic type variable
Instances
KnownSymbol s => FieldTypeName (TSGenericVar s :: Type) Source # | |
Defined in Data.Aeson.Generics.TypeScript fieldTypeName :: Proxy (TSGenericVar s) -> FieldSpec Source # |
data TSInterface Source #
A term constructor in Haskell, most likely an interface in TypeScript
TSInterface | |
|
Instances
Show TSInterface Source # | |
Defined in Data.Aeson.Generics.TypeScript showsPrec :: Int -> TSInterface -> ShowS # show :: TSInterface -> String # showList :: [TSInterface] -> ShowS # | |
Eq TSInterface Source # | |
Defined in Data.Aeson.Generics.TypeScript (==) :: TSInterface -> TSInterface -> Bool # (/=) :: TSInterface -> TSInterface -> Bool # | |
Ord TSInterface Source # | |
Defined in Data.Aeson.Generics.TypeScript compare :: TSInterface -> TSInterface -> Ordering # (<) :: TSInterface -> TSInterface -> Bool # (<=) :: TSInterface -> TSInterface -> Bool # (>) :: TSInterface -> TSInterface -> Bool # (>=) :: TSInterface -> TSInterface -> Bool # max :: TSInterface -> TSInterface -> TSInterface # min :: TSInterface -> TSInterface -> TSInterface # |
The top level TypeScript type declaration
TSType | |
|
Convenience builders
concretely :: String -> FieldSpec Source #
Construct a FieldSpec assuming standard use and a concrete type variable