From e42a97d39800b2aa341fe42995b86aeded823513 Mon Sep 17 00:00:00 2001 From: Mulla Arsiya Tasleem <2400090250@kluniversity.in> Date: Wed, 26 Nov 2025 22:18:51 +0530 Subject: [PATCH] Add isValidElementType function to validate types --- packages/shared/isValidElementType.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 packages/shared/isValidElementType.js diff --git a/packages/shared/isValidElementType.js b/packages/shared/isValidElementType.js new file mode 100644 index 00000000000..f08f002dc58 --- /dev/null +++ b/packages/shared/isValidElementType.js @@ -0,0 +1,18 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +'use strict'; + +function isValidElementType(type) { + return ( + typeof type === 'string' || + typeof type === 'function' || + (type != null && typeof type === 'object' && 'render' in type) + ); +} + +module.exports = isValidElementType;