From 9057b875fa0ec6d851458088c33c1565c175f5b0 Mon Sep 17 00:00:00 2001 From: DominicTobias Date: Thu, 24 Aug 2023 22:01:43 +0100 Subject: [PATCH] Update mapped-types.md Add extra prettier instructions --- website/docs/types/mapped-types.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/website/docs/types/mapped-types.md b/website/docs/types/mapped-types.md index 7c297ead544..0a7a8e4ab08 100644 --- a/website/docs/types/mapped-types.md +++ b/website/docs/types/mapped-types.md @@ -134,6 +134,19 @@ type MappedType = {[key in Union]: number}; To use mapped types, you need to upgrade your infrastructure so that it supports the syntax: - `flow` and `flow-parser`: 0.210.0. Between v0.210.0 to v0.211.1, you need to explicitly enable it in your .flowconfig, under the `[options]` heading, add `mapped_type=true`. -- `prettier`: 3 +- `prettier`: 3. Using hermes-parser via [prettier-plugin-hermes-parser](https://npmjs.com/package/prettier-plugin-hermes-parser): +```json +{ + "plugins": ["prettier-plugin-hermes-parser"], + "overrides": [ + { + "files": ["*.js", "*.jsx", "*.flow"], + "options": { + "parser": "hermes" + } + } + ] +} +``` - `babel` with `babel-plugin-syntax-hermes-parser`. See [our Babel guide](../../tools/babel/) for setup instructions. - `eslint` with `hermes-eslint`. See [our ESLint guide](../../tools/eslint/) for setup instructions.