A framework for building native applications using React
Enforce compatibility with `exactOptionalPropertyTypes` (#36345)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/36345 `exactOptionalPropertyTypes` is a TypeScript 4.4+ option set by users which changes behavior of optional properties, to disable accepting explicit `undefined`. This is not enabled when using `--strict`, and is stricter than Flow, leading to most of the typings having an `| undefined` unique to TypeScript (added with https://github.com/DefinitelyTyped/DefinitelyTyped/commit/694c663a9486dbe7794d5eb894a691ee9ded318a). We have not always followed this (I have myself previously assumed the two are equivalent). We can enforce that the convention is followed with a plugin `eslint-plugin-redundant-undefined`. This forces us to declare that every optional property accepts an explicit undefined (which Flow would allow). Alternatively, if we do not want to support this, we can enable the existing dtslint rule `no-redundant-undefined`. Changelog: [General][Fixed] - Enforce compatibility with `exactOptionalPropertyTypes` Reviewed By: lunaleaps Differential Revision: D43700862 fbshipit-source-id: 996094762b28918177521a9471d868ba87f0f263
N
Nick Gerleman committed
7858a2147fde9f754034577932cb5b22983f658f
Parent: f4e56fd
Committed by Facebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
on 3/8/2023, 8:14:56 AM