{"id":15775116,"url":"https://github.com/katt/typed-form","last_synced_at":"2025-03-31T14:41:07.812Z","repository":{"id":140088189,"uuid":"326033890","full_name":"KATT/typed-form","owner":"KATT","description":"typesafe formik example","archived":false,"fork":false,"pushed_at":"2021-01-01T20:53:05.000Z","size":162,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-10-05T16:42:24.651Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/KATT.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-01-01T18:27:32.000Z","updated_at":"2022-09-12T22:30:35.000Z","dependencies_parsed_at":null,"dependency_job_id":"ffef3325-07d4-4e5b-84ab-2c5cb2535074","html_url":"https://github.com/KATT/typed-form","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KATT%2Ftyped-form","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KATT%2Ftyped-form/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KATT%2Ftyped-form/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KATT%2Ftyped-form/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KATT","download_url":"https://codeload.github.com/KATT/typed-form/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246484170,"owners_count":20785019,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-04T16:42:23.708Z","updated_at":"2025-03-31T14:41:07.787Z","avatar_url":"https://github.com/KATT.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Typed-safe Formik `\u003cField\u003e` etc example\n\nExample of using TypeScript 4.1 [Template Literal Types](https://devblogs.microsoft.com/typescript/announcing-typescript-4-1/#template-literal-types) to give us a type safe usage of [Formik](https://formik.org/) `\u003cField\u003e`s' `name`-attribute (\u0026 `useField` \u0026 `\u003cErrorMessage /\u003e`).\n\n![Code Example](code.gif)\n\n\n\u003e (Does not cover array fields)\n\n\n## How the form component uses it\n\n```tsx\n// Set the initial values\nconst initialValues = {\n  name: \"\",\n  social: {\n    facebook: \"\",\n    twitter: \"\",\n  },\n};\n\n// Create type safe helper components\nconst { Field, ErrorMessage, useField } = typedFormik({\n  initialValues,\n});\n\n// in component:\n\u003cField name='social.twitter' /\u003e\n```\n### View code\n\n- [`pages/index.tsx`](./pages/index.tsx)\n- [`utils/typedFormik.tsx`](./utils/typedFormik.tsx)\n- [`utils/types.ts`](./utils/types.ts)\n\n### Play with it\n\n```bash\ngit clone git@github.com:KATT/typed-form.git cd typed-form \u0026\u0026 yarn \u0026\u0026 yarn dev\n```\n\n---\n\nCreated by [@alexdotjs](https://twitter.com/alexdotjs). Credits to [Craig](https://twitter.com/phenomnominal) who wrote [this article](https://dev.to/phenomnominal/i-need-to-learn-about-typescript-template-literal-types-51po).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkatt%2Ftyped-form","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkatt%2Ftyped-form","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkatt%2Ftyped-form/lists"}