Skip to content

Commit 4a851dd

Browse files
authored
Drop PropertyDescriptor type arguments that the upcoming non-generic builtin rejects
Summary: Flow's builtin `PropertyDescriptor<T = unknown>` is becoming non-generic, as in TypeScript's `lib.es5.d.ts`: its `value`, `get` and `set` use `any`, and `Object.getOwnPropertyDescriptor` no longer takes a type argument. The new builtins reject `PropertyDescriptor<X>` annotations and `Object.getOwnPropertyDescriptor<X>(...)` calls. Remove those type arguments. Today's Flow accepts all of these sites without them. Nothing changes at runtime. Changelog: [Internal] Drop `PropertyDescriptor` type arguments. Differential Revision: D129956546 Pull Request resolved: #59814
1 parent fe398e5 commit 4a851dd

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

‎packages/react-native/Libraries/Utilities/PolyfillFunctions.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export function polyfillObjectProperty<T>(
3030
name: string,
3131
getValue: () => T,
3232
): void {
33-
const descriptor = Object.getOwnPropertyDescriptor<$FlowFixMe>(object, name);
33+
const descriptor = Object.getOwnPropertyDescriptor(object, name);
3434
if (__DEV__ && descriptor) {
3535
const backupName = `original${name[0].toUpperCase()}${name.slice(1)}`;
3636
Object.defineProperty(object, backupName, descriptor);

‎packages/react-native/src/private/webapis/dom/oldstylecollections/HTMLCollection.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import {setPlatformObject} from '../../webidl/PlatformObjects';
1818
// IMPORTANT: The type definition for this module is defined in `HTMLCollection.js.flow`
1919
// because Flow only supports indexers in classes in declaration files.
2020

21-
const REUSABLE_PROPERTY_DESCRIPTOR: {...PropertyDescriptor<unknown>, ...} = {
21+
const REUSABLE_PROPERTY_DESCRIPTOR: {...PropertyDescriptor, ...} = {
2222
value: {},
2323
enumerable: true,
2424
configurable: false,

‎packages/react-native/src/private/webapis/dom/oldstylecollections/NodeList.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import {setPlatformObject} from '../../webidl/PlatformObjects';
2222
// IMPORTANT: The Flow type definition for this module is defined in `NodeList.js.flow`
2323
// because Flow only supports indexers in classes in declaration files.
2424

25-
const REUSABLE_PROPERTY_DESCRIPTOR: {...PropertyDescriptor<unknown>, ...} = {
25+
const REUSABLE_PROPERTY_DESCRIPTOR: {...PropertyDescriptor, ...} = {
2626
value: {},
2727
writable: false,
2828
};

0 commit comments

Comments
 (0)