Extract and encode Prettynice component props.

Props define the shape of the data passed into your component when you embed it in your server-side HTML. They are similar to flags in elm.

This module is used internally by the framework. It is not intended to be used in your application code.

...but it may be helpful to understand how your component props are parsed and what field types are supported.

type alias Props = Dict String FieldType

Internal mapping of prop field name to field type.

For example, props like this:

type alias Props =
    { name : String
    , age : Int

would be represented internally like this:

    [ { key = "name", value = StringType }
    , { key = "age", value = IntType }

See FieldType for supported types.

type FieldType

Represents the type of a prop field.

Support prop field types are:

  • Int
  • Float
  • String
  • Bool
  • Array
  • Maybe
get : String -> Result (Array DeadEnd) Props

Given the string contents of a component source file, parse the Props and return the result.

encoder : Props -> String

Return a string with the gren code to encode the given props.

typeSig : Props -> String

Return a string with the gren type signature for the given props.