Skip to content
This repository has been archived by the owner on Feb 21, 2023. It is now read-only.

Make i18n typesafe when using folder collections #336

Open
Bakkhos opened this issue Dec 5, 2019 · 1 comment
Open

Make i18n typesafe when using folder collections #336

Bakkhos opened this issue Dec 5, 2019 · 1 comment
Labels
enhancement New feature or request

Comments

@Bakkhos
Copy link
Contributor

Bakkhos commented Dec 5, 2019

Currently the JSON data imported by /src/data/index.tsx files is not type checked in those cases where one is using importAll (rather than import) - that is, in case of folder collections.

Ideally these types would be checked somehow, so that the app does not crash when the json files are corrupt (e.g. because netlify cms writes unexpected things in there)

@Bakkhos Bakkhos added the enhancement New feature or request label Dec 5, 2019
@Bakkhos
Copy link
Contributor Author

Bakkhos commented Dec 5, 2019

The simplest way probably is to go and change netlify cms to write a single json file containing a list, instad of one json file per collection entry. Even better would be to output typescript right away, with type definitions for each collection automatically derived from the widgets and the schema.

Then we can dump importAll entirely and just use import.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant