Reads the text entered for a value of the given type. Returns:

  • a literal of the type's kind, with numbers in canonical form;
  • {kind: 'invalid', text} when the text is not a value of the type, keeping the text as typed so it can be shown and fixed;
  • undefined when the input is empty.

STRING values are taken as typed: they are not trimmed, and '' is a value.