Best JavaScript code snippet using playwright-internal
factoryWithTypeCheckers.js
Source:factoryWithTypeCheckers.js
...145 * Errors anymore. We don't inspect their stack anyway, and creating them146 * is prohibitively expensive if they are created too often, such as what147 * happens in oneOfType() for any type before the one that matched.148 */149 function PropTypeError(message, data) {150 this.message = message;151 this.data = data && typeof data === 'object' ? data: {};152 this.stack = '';153 }154 // Make `instanceof Error` still work for returned errors.155 PropTypeError.prototype = Error.prototype;156 function createChainableTypeChecker(validate) {157 if (process.env.NODE_ENV !== 'production') {158 var manualPropTypeCallCache = {};159 var manualPropTypeWarningCount = 0;160 }161 function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {162 componentName = componentName || ANONYMOUS;163 propFullName = propFullName || propName;164 if (secret !== ReactPropTypesSecret) {165 if (throwOnDirectAccess) {166 // New behavior only for users of `prop-types` package167 var err = new Error(168 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +169 'Use `PropTypes.checkPropTypes()` to call them. ' +170 'Read more at http://fb.me/use-check-prop-types'171 );172 err.name = 'Invariant Violation';173 throw err;174 } else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') {175 // Old behavior for people using React.PropTypes176 var cacheKey = componentName + ':' + propName;177 if (178 !manualPropTypeCallCache[cacheKey] &&179 // Avoid spamming the console because they are often not actionable except for lib authors180 manualPropTypeWarningCount < 3181 ) {182 printWarning(183 'You are manually calling a React.PropTypes validation ' +184 'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' +185 'and will throw in the standalone `prop-types` package. ' +186 'You may be seeing this warning due to a third-party PropTypes ' +187 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.'188 );189 manualPropTypeCallCache[cacheKey] = true;190 manualPropTypeWarningCount++;191 }192 }193 }194 if (props[propName] == null) {195 if (isRequired) {196 if (props[propName] === null) {197 return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));198 }199 return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));200 }201 return null;202 } else {203 return validate(props, propName, componentName, location, propFullName);204 }205 }206 var chainedCheckType = checkType.bind(null, false);207 chainedCheckType.isRequired = checkType.bind(null, true);208 return chainedCheckType;209 }210 function createPrimitiveTypeChecker(expectedType) {211 function validate(props, propName, componentName, location, propFullName, secret) {212 var propValue = props[propName];213 var propType = getPropType(propValue);214 if (propType !== expectedType) {215 // `propValue` being instance of, say, date/regexp, pass the 'object'216 // check, but we can offer a more precise error message here rather than217 // 'of type `object`'.218 var preciseType = getPreciseType(propValue);219 return new PropTypeError(220 'Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'),221 {expectedType: expectedType}222 );223 }224 return null;225 }226 return createChainableTypeChecker(validate);227 }228 function createAnyTypeChecker() {229 return createChainableTypeChecker(emptyFunctionThatReturnsNull);230 }231 function createArrayOfTypeChecker(typeChecker) {232 function validate(props, propName, componentName, location, propFullName) {233 if (typeof typeChecker !== 'function') {234 return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');235 }236 var propValue = props[propName];237 if (!Array.isArray(propValue)) {238 var propType = getPropType(propValue);239 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));240 }241 for (var i = 0; i < propValue.length; i++) {242 var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret);243 if (error instanceof Error) {244 return error;245 }246 }247 return null;248 }249 return createChainableTypeChecker(validate);250 }251 function createElementTypeChecker() {252 function validate(props, propName, componentName, location, propFullName) {253 var propValue = props[propName];254 if (!isValidElement(propValue)) {255 var propType = getPropType(propValue);256 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));257 }258 return null;259 }260 return createChainableTypeChecker(validate);261 }262 function createElementTypeTypeChecker() {263 function validate(props, propName, componentName, location, propFullName) {264 var propValue = props[propName];265 if (!ReactIs.isValidElementType(propValue)) {266 var propType = getPropType(propValue);267 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement type.'));268 }269 return null;270 }271 return createChainableTypeChecker(validate);272 }273 function createInstanceTypeChecker(expectedClass) {274 function validate(props, propName, componentName, location, propFullName) {275 if (!(props[propName] instanceof expectedClass)) {276 var expectedClassName = expectedClass.name || ANONYMOUS;277 var actualClassName = getClassName(props[propName]);278 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));279 }280 return null;281 }282 return createChainableTypeChecker(validate);283 }284 function createEnumTypeChecker(expectedValues) {285 if (!Array.isArray(expectedValues)) {286 if (process.env.NODE_ENV !== 'production') {287 if (arguments.length > 1) {288 printWarning(289 'Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' +290 'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).'291 );292 } else {293 printWarning('Invalid argument supplied to oneOf, expected an array.');294 }295 }296 return emptyFunctionThatReturnsNull;297 }298 function validate(props, propName, componentName, location, propFullName) {299 var propValue = props[propName];300 for (var i = 0; i < expectedValues.length; i++) {301 if (is(propValue, expectedValues[i])) {302 return null;303 }304 }305 var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {306 var type = getPreciseType(value);307 if (type === 'symbol') {308 return String(value);309 }310 return value;311 });312 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));313 }314 return createChainableTypeChecker(validate);315 }316 function createObjectOfTypeChecker(typeChecker) {317 function validate(props, propName, componentName, location, propFullName) {318 if (typeof typeChecker !== 'function') {319 return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');320 }321 var propValue = props[propName];322 var propType = getPropType(propValue);323 if (propType !== 'object') {324 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));325 }326 for (var key in propValue) {327 if (has(propValue, key)) {328 var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);329 if (error instanceof Error) {330 return error;331 }332 }333 }334 return null;335 }336 return createChainableTypeChecker(validate);337 }338 function createUnionTypeChecker(arrayOfTypeCheckers) {339 if (!Array.isArray(arrayOfTypeCheckers)) {340 process.env.NODE_ENV !== 'production' ? printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;341 return emptyFunctionThatReturnsNull;342 }343 for (var i = 0; i < arrayOfTypeCheckers.length; i++) {344 var checker = arrayOfTypeCheckers[i];345 if (typeof checker !== 'function') {346 printWarning(347 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +348 'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.'349 );350 return emptyFunctionThatReturnsNull;351 }352 }353 function validate(props, propName, componentName, location, propFullName) {354 var expectedTypes = [];355 for (var i = 0; i < arrayOfTypeCheckers.length; i++) {356 var checker = arrayOfTypeCheckers[i];357 var checkerResult = checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret);358 if (checkerResult == null) {359 return null;360 }361 if (checkerResult.data && has(checkerResult.data, 'expectedType')) {362 expectedTypes.push(checkerResult.data.expectedType);363 }364 }365 var expectedTypesMessage = (expectedTypes.length > 0) ? ', expected one of type [' + expectedTypes.join(', ') + ']': '';366 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`' + expectedTypesMessage + '.'));367 }368 return createChainableTypeChecker(validate);369 }370 function createNodeChecker() {371 function validate(props, propName, componentName, location, propFullName) {372 if (!isNode(props[propName])) {373 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));374 }375 return null;376 }377 return createChainableTypeChecker(validate);378 }379 function invalidValidatorError(componentName, location, propFullName, key, type) {380 return new PropTypeError(381 (componentName || 'React class') + ': ' + location + ' type `' + propFullName + '.' + key + '` is invalid; ' +382 'it must be a function, usually from the `prop-types` package, but received `' + type + '`.'383 );384 }385 function createShapeTypeChecker(shapeTypes) {386 function validate(props, propName, componentName, location, propFullName) {387 var propValue = props[propName];388 var propType = getPropType(propValue);389 if (propType !== 'object') {390 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));391 }392 for (var key in shapeTypes) {393 var checker = shapeTypes[key];394 if (typeof checker !== 'function') {395 return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));396 }397 var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);398 if (error) {399 return error;400 }401 }402 return null;403 }404 return createChainableTypeChecker(validate);405 }406 function createStrictShapeTypeChecker(shapeTypes) {407 function validate(props, propName, componentName, location, propFullName) {408 var propValue = props[propName];409 var propType = getPropType(propValue);410 if (propType !== 'object') {411 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));412 }413 // We need to check all keys in case some are required but missing from props.414 var allKeys = assign({}, props[propName], shapeTypes);415 for (var key in allKeys) {416 var checker = shapeTypes[key];417 if (has(shapeTypes, key) && typeof checker !== 'function') {418 return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));419 }420 if (!checker) {421 return new PropTypeError(422 'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +423 '\nBad object: ' + JSON.stringify(props[propName], null, ' ') +424 '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')425 );426 }427 var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);428 if (error) {429 return error;430 }431 }432 return null;433 }434 return createChainableTypeChecker(validate);435 }...
ReactPropTypes.js
Source:ReactPropTypes.js
...134 * Errors anymore. We don't inspect their stack anyway, and creating them135 * is prohibitively expensive if they are created too often, such as what136 * happens in oneOfType() for any type before the one that matched.137 */138function PropTypeError(message) {139 this.message = message;140 this.stack = '';141}142// Make `instanceof Error` still work for returned errors.143PropTypeError.prototype = Error.prototype;144function createChainableTypeChecker(validate) {145 function checkType(146 isRequired,147 props,148 propName,149 componentName,150 location,151 propFullName152 ) {153 componentName = componentName || ANONYMOUS;154 propFullName = propFullName || propName;155 if (props[propName] == null) {156 var locationName = ReactPropTypeLocationNames[location];157 if (isRequired) {158 if (props[propName] === null) {159 return new PropTypeError(160 `The ${locationName} \`${propFullName}\` is marked as required ` +161 `in \`${componentName}\`, but its value is \`null\`.`162 );163 }164 return new PropTypeError(165 `The ${locationName} \`${propFullName}\` is marked as required in ` +166 `\`${componentName}\`, but its value is \`undefined\`.`167 );168 }169 return null;170 } else {171 return validate(props, propName, componentName, location, propFullName);172 }173 }174 var chainedCheckType = checkType.bind(null, false);175 chainedCheckType.isRequired = checkType.bind(null, true);176 return chainedCheckType;177}178function createPrimitiveTypeChecker(expectedType) {179 function validate(props, propName, componentName, location, propFullName) {180 var propValue = props[propName];181 var propType = getPropType(propValue);182 if (propType !== expectedType) {183 var locationName = ReactPropTypeLocationNames[location];184 // `propValue` being instance of, say, date/regexp, pass the 'object'185 // check, but we can offer a more precise error message here rather than186 // 'of type `object`'.187 var preciseType = getPreciseType(propValue);188 return new PropTypeError(189 `Invalid ${locationName} \`${propFullName}\` of type ` +190 `\`${preciseType}\` supplied to \`${componentName}\`, expected ` +191 `\`${expectedType}\`.`192 );193 }194 return null;195 }196 return createChainableTypeChecker(validate);197}198function createAnyTypeChecker() {199 return createChainableTypeChecker(emptyFunction.thatReturnsNull);200}201function createArrayOfTypeChecker(typeChecker) {202 function validate(props, propName, componentName, location, propFullName) {203 if (typeof typeChecker !== 'function') {204 return new PropTypeError(205 `Property \`${propFullName}\` of component \`${componentName}\` has invalid PropType notation inside arrayOf.`206 );207 }208 var propValue = props[propName];209 if (!Array.isArray(propValue)) {210 var locationName = ReactPropTypeLocationNames[location];211 var propType = getPropType(propValue);212 return new PropTypeError(213 `Invalid ${locationName} \`${propFullName}\` of type ` +214 `\`${propType}\` supplied to \`${componentName}\`, expected an array.`215 );216 }217 for (var i = 0; i < propValue.length; i++) {218 var error = typeChecker(219 propValue,220 i,221 componentName,222 location,223 `${propFullName}[${i}]`224 );225 if (error instanceof Error) {226 return error;227 }228 }229 return null;230 }231 return createChainableTypeChecker(validate);232}233function createElementTypeChecker() {234 function validate(props, propName, componentName, location, propFullName) {235 var propValue = props[propName];236 if (!ReactElement.isValidElement(propValue)) {237 var locationName = ReactPropTypeLocationNames[location];238 var propType = getPropType(propValue);239 return new PropTypeError(240 `Invalid ${locationName} \`${propFullName}\` of type ` +241 `\`${propType}\` supplied to \`${componentName}\`, expected a single ReactElement.`242 );243 }244 return null;245 }246 return createChainableTypeChecker(validate);247}248function createInstanceTypeChecker(expectedClass) {249 function validate(props, propName, componentName, location, propFullName) {250 if (!(props[propName] instanceof expectedClass)) {251 var locationName = ReactPropTypeLocationNames[location];252 var expectedClassName = expectedClass.name || ANONYMOUS;253 var actualClassName = getClassName(props[propName]);254 return new PropTypeError(255 `Invalid ${locationName} \`${propFullName}\` of type ` +256 `\`${actualClassName}\` supplied to \`${componentName}\`, expected ` +257 `instance of \`${expectedClassName}\`.`258 );259 }260 return null;261 }262 return createChainableTypeChecker(validate);263}264function createEnumTypeChecker(expectedValues) {265 if (!Array.isArray(expectedValues)) {266 warning(false, 'Invalid argument supplied to oneOf, expected an instance of array.');267 return emptyFunction.thatReturnsNull;268 }269 function validate(props, propName, componentName, location, propFullName) {270 var propValue = props[propName];271 for (var i = 0; i < expectedValues.length; i++) {272 if (is(propValue, expectedValues[i])) {273 return null;274 }275 }276 var locationName = ReactPropTypeLocationNames[location];277 var valuesString = JSON.stringify(expectedValues);278 return new PropTypeError(279 `Invalid ${locationName} \`${propFullName}\` of value \`${propValue}\` ` +280 `supplied to \`${componentName}\`, expected one of ${valuesString}.`281 );282 }283 return createChainableTypeChecker(validate);284}285function createObjectOfTypeChecker(typeChecker) {286 function validate(props, propName, componentName, location, propFullName) {287 if (typeof typeChecker !== 'function') {288 return new PropTypeError(289 `Property \`${propFullName}\` of component \`${componentName}\` has invalid PropType notation inside objectOf.`290 );291 }292 var propValue = props[propName];293 var propType = getPropType(propValue);294 if (propType !== 'object') {295 var locationName = ReactPropTypeLocationNames[location];296 return new PropTypeError(297 `Invalid ${locationName} \`${propFullName}\` of type ` +298 `\`${propType}\` supplied to \`${componentName}\`, expected an object.`299 );300 }301 for (var key in propValue) {302 if (propValue.hasOwnProperty(key)) {303 var error = typeChecker(304 propValue,305 key,306 componentName,307 location,308 `${propFullName}.${key}`309 );310 if (error instanceof Error) {311 return error;312 }313 }314 }315 return null;316 }317 return createChainableTypeChecker(validate);318}319function createUnionTypeChecker(arrayOfTypeCheckers) {320 if (!Array.isArray(arrayOfTypeCheckers)) {321 warning(false, 'Invalid argument supplied to oneOfType, expected an instance of array.');322 return emptyFunction.thatReturnsNull;323 }324 function validate(props, propName, componentName, location, propFullName) {325 for (var i = 0; i < arrayOfTypeCheckers.length; i++) {326 var checker = arrayOfTypeCheckers[i];327 if (328 checker(props, propName, componentName, location, propFullName) == null329 ) {330 return null;331 }332 }333 var locationName = ReactPropTypeLocationNames[location];334 return new PropTypeError(335 `Invalid ${locationName} \`${propFullName}\` supplied to ` +336 `\`${componentName}\`.`337 );338 }339 return createChainableTypeChecker(validate);340}341function createNodeChecker() {342 function validate(props, propName, componentName, location, propFullName) {343 if (!isNode(props[propName])) {344 var locationName = ReactPropTypeLocationNames[location];345 return new PropTypeError(346 `Invalid ${locationName} \`${propFullName}\` supplied to ` +347 `\`${componentName}\`, expected a ReactNode.`348 );349 }350 return null;351 }352 return createChainableTypeChecker(validate);353}354function createShapeTypeChecker(shapeTypes) {355 function validate(props, propName, componentName, location, propFullName) {356 var propValue = props[propName];357 var propType = getPropType(propValue);358 if (propType !== 'object') {359 var locationName = ReactPropTypeLocationNames[location];360 return new PropTypeError(361 `Invalid ${locationName} \`${propFullName}\` of type \`${propType}\` ` +362 `supplied to \`${componentName}\`, expected \`object\`.`363 );364 }365 for (var key in shapeTypes) {366 var checker = shapeTypes[key];367 if (!checker) {368 continue;369 }370 var error = checker(371 propValue,372 key,373 componentName,374 location,...
0369f41c524ef5e71d157de3cc2617de31a11aReactPropTypes.js
Source:0369f41c524ef5e71d157de3cc2617de31a11aReactPropTypes.js
...60 } else {61 return x !== x && y !== y;62 }63}64function PropTypeError(message) {65 this.message = message;66 this.stack = '';67}68PropTypeError.prototype = Error.prototype;69function createChainableTypeChecker(validate) {70 if (process.env.NODE_ENV !== 'production') {71 var manualPropTypeCallCache = {};72 }73 function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {74 componentName = componentName || ANONYMOUS;75 propFullName = propFullName || propName;76 if (process.env.NODE_ENV !== 'production') {77 if (secret !== ReactPropTypesSecret && typeof console !== 'undefined') {78 var cacheKey = componentName + ':' + propName;79 if (!manualPropTypeCallCache[cacheKey]) {80 process.env.NODE_ENV !== 'production' ? warning(false, 'You are manually calling a React.PropTypes validation ' + 'function for the `%s` prop on `%s`. This is deprecated ' + 'and will not work in production with the next major version. ' + 'You may be seeing this warning due to a third-party PropTypes ' + 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.', propFullName, componentName) : void 0;81 manualPropTypeCallCache[cacheKey] = true;82 }83 }84 }85 if (props[propName] == null) {86 if (isRequired) {87 if (props[propName] === null) {88 return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));89 }90 return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));91 }92 return null;93 } else {94 return validate(props, propName, componentName, location, propFullName);95 }96 }97 var chainedCheckType = checkType.bind(null, false);98 chainedCheckType.isRequired = checkType.bind(null, true);99 return chainedCheckType;100}101function createPrimitiveTypeChecker(expectedType) {102 function validate(props, propName, componentName, location, propFullName, secret) {103 var propValue = props[propName];104 var propType = getPropType(propValue);105 if (propType !== expectedType) {106 var preciseType = getPreciseType(propValue);107 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));108 }109 return null;110 }111 return createChainableTypeChecker(validate);112}113function createAnyTypeChecker() {114 return createChainableTypeChecker(emptyFunction.thatReturnsNull);115}116function createArrayOfTypeChecker(typeChecker) {117 function validate(props, propName, componentName, location, propFullName) {118 if (typeof typeChecker !== 'function') {119 return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');120 }121 var propValue = props[propName];122 if (!Array.isArray(propValue)) {123 var propType = getPropType(propValue);124 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));125 }126 for (var i = 0; i < propValue.length; i++) {127 var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret);128 if (error instanceof Error) {129 return error;130 }131 }132 return null;133 }134 return createChainableTypeChecker(validate);135}136function createElementTypeChecker() {137 function validate(props, propName, componentName, location, propFullName) {138 var propValue = props[propName];139 if (!ReactElement.isValidElement(propValue)) {140 var propType = getPropType(propValue);141 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));142 }143 return null;144 }145 return createChainableTypeChecker(validate);146}147function createInstanceTypeChecker(expectedClass) {148 function validate(props, propName, componentName, location, propFullName) {149 if (!(props[propName] instanceof expectedClass)) {150 var expectedClassName = expectedClass.name || ANONYMOUS;151 var actualClassName = getClassName(props[propName]);152 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));153 }154 return null;155 }156 return createChainableTypeChecker(validate);157}158function createEnumTypeChecker(expectedValues) {159 if (!Array.isArray(expectedValues)) {160 process.env.NODE_ENV !== 'production' ? warning(false, 'Invalid argument supplied to oneOf, expected an instance of array.') : void 0;161 return emptyFunction.thatReturnsNull;162 }163 function validate(props, propName, componentName, location, propFullName) {164 var propValue = props[propName];165 for (var i = 0; i < expectedValues.length; i++) {166 if (is(propValue, expectedValues[i])) {167 return null;168 }169 }170 var valuesString = JSON.stringify(expectedValues);171 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));172 }173 return createChainableTypeChecker(validate);174}175function createObjectOfTypeChecker(typeChecker) {176 function validate(props, propName, componentName, location, propFullName) {177 if (typeof typeChecker !== 'function') {178 return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');179 }180 var propValue = props[propName];181 var propType = getPropType(propValue);182 if (propType !== 'object') {183 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));184 }185 for (var key in propValue) {186 if (propValue.hasOwnProperty(key)) {187 var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);188 if (error instanceof Error) {189 return error;190 }191 }192 }193 return null;194 }195 return createChainableTypeChecker(validate);196}197function createUnionTypeChecker(arrayOfTypeCheckers) {198 if (!Array.isArray(arrayOfTypeCheckers)) {199 process.env.NODE_ENV !== 'production' ? warning(false, 'Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;200 return emptyFunction.thatReturnsNull;201 }202 function validate(props, propName, componentName, location, propFullName) {203 for (var i = 0; i < arrayOfTypeCheckers.length; i++) {204 var checker = arrayOfTypeCheckers[i];205 if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret) == null) {206 return null;207 }208 }209 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));210 }211 return createChainableTypeChecker(validate);212}213function createNodeChecker() {214 function validate(props, propName, componentName, location, propFullName) {215 if (!isNode(props[propName])) {216 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));217 }218 return null;219 }220 return createChainableTypeChecker(validate);221}222function createShapeTypeChecker(shapeTypes) {223 function validate(props, propName, componentName, location, propFullName) {224 var propValue = props[propName];225 var propType = getPropType(propValue);226 if (propType !== 'object') {227 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));228 }229 for (var key in shapeTypes) {230 var checker = shapeTypes[key];231 if (!checker) {232 continue;233 }234 var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);235 if (error) {236 return error;237 }238 }239 return null;240 }241 return createChainableTypeChecker(validate);...
715005ReactPropTypes.js
Source:715005ReactPropTypes.js
...30 } else {31 return x !== x && y !== y;32 }33}34function PropTypeError(message) {35 this.message = message;36 this.stack = '';37}38PropTypeError.prototype = Error.prototype;39function createChainableTypeChecker(validate) {40 if (process.env.NODE_ENV !== 'production') {41 var manualPropTypeCallCache = {};42 }43 function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {44 componentName = componentName || ANONYMOUS;45 propFullName = propFullName || propName;46 if (process.env.NODE_ENV !== 'production') {47 if (secret !== ReactPropTypesSecret && typeof console !== 'undefined') {48 var cacheKey = componentName + ':' + propName;49 if (!manualPropTypeCallCache[cacheKey]) {50 process.env.NODE_ENV !== 'production' ? warning(false, 'You are manually calling a React.PropTypes validation ' + 'function for the `%s` prop on `%s`. This is deprecated ' + 'and will not work in production with the next major version. ' + 'You may be seeing this warning due to a third-party PropTypes ' + 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.', propFullName, componentName) : void 0;51 manualPropTypeCallCache[cacheKey] = true;52 }53 }54 }55 if (props[propName] == null) {56 var locationName = ReactPropTypeLocationNames[location];57 if (isRequired) {58 if (props[propName] === null) {59 return new PropTypeError('The ' + locationName + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));60 }61 return new PropTypeError('The ' + locationName + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));62 }63 return null;64 } else {65 return validate(props, propName, componentName, location, propFullName);66 }67 }68 var chainedCheckType = checkType.bind(null, false);69 chainedCheckType.isRequired = checkType.bind(null, true);70 return chainedCheckType;71}72function createPrimitiveTypeChecker(expectedType) {73 function validate(props, propName, componentName, location, propFullName, secret) {74 var propValue = props[propName];75 var propType = getPropType(propValue);76 if (propType !== expectedType) {77 var locationName = ReactPropTypeLocationNames[location];78 var preciseType = getPreciseType(propValue);79 return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));80 }81 return null;82 }83 return createChainableTypeChecker(validate);84}85function createAnyTypeChecker() {86 return createChainableTypeChecker(emptyFunction.thatReturns(null));87}88function createArrayOfTypeChecker(typeChecker) {89 function validate(props, propName, componentName, location, propFullName) {90 if (typeof typeChecker !== 'function') {91 return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');92 }93 var propValue = props[propName];94 if (!Array.isArray(propValue)) {95 var locationName = ReactPropTypeLocationNames[location];96 var propType = getPropType(propValue);97 return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));98 }99 for (var i = 0; i < propValue.length; i++) {100 var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret);101 if (error instanceof Error) {102 return error;103 }104 }105 return null;106 }107 return createChainableTypeChecker(validate);108}109function createElementTypeChecker() {110 function validate(props, propName, componentName, location, propFullName) {111 var propValue = props[propName];112 if (!ReactElement.isValidElement(propValue)) {113 var locationName = ReactPropTypeLocationNames[location];114 var propType = getPropType(propValue);115 return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));116 }117 return null;118 }119 return createChainableTypeChecker(validate);120}121function createInstanceTypeChecker(expectedClass) {122 function validate(props, propName, componentName, location, propFullName) {123 if (!(props[propName] instanceof expectedClass)) {124 var locationName = ReactPropTypeLocationNames[location];125 var expectedClassName = expectedClass.name || ANONYMOUS;126 var actualClassName = getClassName(props[propName]);127 return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));128 }129 return null;130 }131 return createChainableTypeChecker(validate);132}133function createEnumTypeChecker(expectedValues) {134 if (!Array.isArray(expectedValues)) {135 process.env.NODE_ENV !== 'production' ? warning(false, 'Invalid argument supplied to oneOf, expected an instance of array.') : void 0;136 return emptyFunction.thatReturnsNull;137 }138 function validate(props, propName, componentName, location, propFullName) {139 var propValue = props[propName];140 for (var i = 0; i < expectedValues.length; i++) {141 if (is(propValue, expectedValues[i])) {142 return null;143 }144 }145 var locationName = ReactPropTypeLocationNames[location];146 var valuesString = JSON.stringify(expectedValues);147 return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));148 }149 return createChainableTypeChecker(validate);150}151function createObjectOfTypeChecker(typeChecker) {152 function validate(props, propName, componentName, location, propFullName) {153 if (typeof typeChecker !== 'function') {154 return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');155 }156 var propValue = props[propName];157 var propType = getPropType(propValue);158 if (propType !== 'object') {159 var locationName = ReactPropTypeLocationNames[location];160 return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));161 }162 for (var key in propValue) {163 if (propValue.hasOwnProperty(key)) {164 var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);165 if (error instanceof Error) {166 return error;167 }168 }169 }170 return null;171 }172 return createChainableTypeChecker(validate);173}174function createUnionTypeChecker(arrayOfTypeCheckers) {175 if (!Array.isArray(arrayOfTypeCheckers)) {176 process.env.NODE_ENV !== 'production' ? warning(false, 'Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;177 return emptyFunction.thatReturnsNull;178 }179 function validate(props, propName, componentName, location, propFullName) {180 for (var i = 0; i < arrayOfTypeCheckers.length; i++) {181 var checker = arrayOfTypeCheckers[i];182 if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret) == null) {183 return null;184 }185 }186 var locationName = ReactPropTypeLocationNames[location];187 return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));188 }189 return createChainableTypeChecker(validate);190}191function createNodeChecker() {192 function validate(props, propName, componentName, location, propFullName) {193 if (!isNode(props[propName])) {194 var locationName = ReactPropTypeLocationNames[location];195 return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));196 }197 return null;198 }199 return createChainableTypeChecker(validate);200}201function createShapeTypeChecker(shapeTypes) {202 function validate(props, propName, componentName, location, propFullName) {203 var propValue = props[propName];204 var propType = getPropType(propValue);205 if (propType !== 'object') {206 var locationName = ReactPropTypeLocationNames[location];207 return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));208 }209 for (var key in shapeTypes) {210 var checker = shapeTypes[key];211 if (!checker) {212 continue;213 }214 var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);215 if (error) {216 return error;217 }218 }219 return null;220 }221 return createChainableTypeChecker(validate);...
a97565ReactPropTypes.js
Source:a97565ReactPropTypes.js
...30 } else {31 return x !== x && y !== y;32 }33}34function PropTypeError(message) {35 this.message = message;36 this.stack = '';37}38PropTypeError.prototype = Error.prototype;39function createChainableTypeChecker(validate) {40 if (process.env.NODE_ENV !== 'production') {41 var manualPropTypeCallCache = {};42 }43 function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {44 componentName = componentName || ANONYMOUS;45 propFullName = propFullName || propName;46 if (process.env.NODE_ENV !== 'production') {47 if (secret !== ReactPropTypesSecret && typeof console !== 'undefined') {48 var cacheKey = componentName + ':' + propName;49 if (!manualPropTypeCallCache[cacheKey]) {50 process.env.NODE_ENV !== 'production' ? warning(false, 'You are manually calling a React.PropTypes validation ' + 'function for the `%s` prop on `%s`. This is deprecated ' + 'and will not work in production with the next major version. ' + 'You may be seeing this warning due to a third-party PropTypes ' + 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.', propFullName, componentName) : void 0;51 manualPropTypeCallCache[cacheKey] = true;52 }53 }54 }55 if (props[propName] == null) {56 var locationName = ReactPropTypeLocationNames[location];57 if (isRequired) {58 if (props[propName] === null) {59 return new PropTypeError('The ' + locationName + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));60 }61 return new PropTypeError('The ' + locationName + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));62 }63 return null;64 } else {65 return validate(props, propName, componentName, location, propFullName);66 }67 }68 var chainedCheckType = checkType.bind(null, false);69 chainedCheckType.isRequired = checkType.bind(null, true);70 return chainedCheckType;71}72function createPrimitiveTypeChecker(expectedType) {73 function validate(props, propName, componentName, location, propFullName, secret) {74 var propValue = props[propName];75 var propType = getPropType(propValue);76 if (propType !== expectedType) {77 var locationName = ReactPropTypeLocationNames[location];78 var preciseType = getPreciseType(propValue);79 return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));80 }81 return null;82 }83 return createChainableTypeChecker(validate);84}85function createAnyTypeChecker() {86 return createChainableTypeChecker(emptyFunction.thatReturns(null));87}88function createArrayOfTypeChecker(typeChecker) {89 function validate(props, propName, componentName, location, propFullName) {90 if (typeof typeChecker !== 'function') {91 return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');92 }93 var propValue = props[propName];94 if (!Array.isArray(propValue)) {95 var locationName = ReactPropTypeLocationNames[location];96 var propType = getPropType(propValue);97 return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));98 }99 for (var i = 0; i < propValue.length; i++) {100 var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret);101 if (error instanceof Error) {102 return error;103 }104 }105 return null;106 }107 return createChainableTypeChecker(validate);108}109function createElementTypeChecker() {110 function validate(props, propName, componentName, location, propFullName) {111 var propValue = props[propName];112 if (!ReactElement.isValidElement(propValue)) {113 var locationName = ReactPropTypeLocationNames[location];114 var propType = getPropType(propValue);115 return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));116 }117 return null;118 }119 return createChainableTypeChecker(validate);120}121function createInstanceTypeChecker(expectedClass) {122 function validate(props, propName, componentName, location, propFullName) {123 if (!(props[propName] instanceof expectedClass)) {124 var locationName = ReactPropTypeLocationNames[location];125 var expectedClassName = expectedClass.name || ANONYMOUS;126 var actualClassName = getClassName(props[propName]);127 return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));128 }129 return null;130 }131 return createChainableTypeChecker(validate);132}133function createEnumTypeChecker(expectedValues) {134 if (!Array.isArray(expectedValues)) {135 process.env.NODE_ENV !== 'production' ? warning(false, 'Invalid argument supplied to oneOf, expected an instance of array.') : void 0;136 return emptyFunction.thatReturnsNull;137 }138 function validate(props, propName, componentName, location, propFullName) {139 var propValue = props[propName];140 for (var i = 0; i < expectedValues.length; i++) {141 if (is(propValue, expectedValues[i])) {142 return null;143 }144 }145 var locationName = ReactPropTypeLocationNames[location];146 var valuesString = JSON.stringify(expectedValues);147 return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));148 }149 return createChainableTypeChecker(validate);150}151function createObjectOfTypeChecker(typeChecker) {152 function validate(props, propName, componentName, location, propFullName) {153 if (typeof typeChecker !== 'function') {154 return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');155 }156 var propValue = props[propName];157 var propType = getPropType(propValue);158 if (propType !== 'object') {159 var locationName = ReactPropTypeLocationNames[location];160 return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));161 }162 for (var key in propValue) {163 if (propValue.hasOwnProperty(key)) {164 var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);165 if (error instanceof Error) {166 return error;167 }168 }169 }170 return null;171 }172 return createChainableTypeChecker(validate);173}174function createUnionTypeChecker(arrayOfTypeCheckers) {175 if (!Array.isArray(arrayOfTypeCheckers)) {176 process.env.NODE_ENV !== 'production' ? warning(false, 'Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;177 return emptyFunction.thatReturnsNull;178 }179 function validate(props, propName, componentName, location, propFullName) {180 for (var i = 0; i < arrayOfTypeCheckers.length; i++) {181 var checker = arrayOfTypeCheckers[i];182 if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret) == null) {183 return null;184 }185 }186 var locationName = ReactPropTypeLocationNames[location];187 return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));188 }189 return createChainableTypeChecker(validate);190}191function createNodeChecker() {192 function validate(props, propName, componentName, location, propFullName) {193 if (!isNode(props[propName])) {194 var locationName = ReactPropTypeLocationNames[location];195 return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));196 }197 return null;198 }199 return createChainableTypeChecker(validate);200}201function createShapeTypeChecker(shapeTypes) {202 function validate(props, propName, componentName, location, propFullName) {203 var propValue = props[propName];204 var propType = getPropType(propValue);205 if (propType !== 'object') {206 var locationName = ReactPropTypeLocationNames[location];207 return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));208 }209 for (var key in shapeTypes) {210 var checker = shapeTypes[key];211 if (!checker) {212 continue;213 }214 var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);215 if (error) {216 return error;217 }218 }219 return null;220 }221 return createChainableTypeChecker(validate);...
1cd243ReactPropTypes.js
Source:1cd243ReactPropTypes.js
...29}else{30return x!==x&&y!==y;31}32}33function PropTypeError(message){34this.message=message;35this.stack='';36}37PropTypeError.prototype=Error.prototype;38function createChainableTypeChecker(validate){39if(process.env.NODE_ENV!=='production'){40var manualPropTypeCallCache={};41}42function checkType(isRequired,props,propName,componentName,location,propFullName,secret){43componentName=componentName||ANONYMOUS;44propFullName=propFullName||propName;45if(process.env.NODE_ENV!=='production'){46if(secret!==ReactPropTypesSecret&&typeof console!=='undefined'){47var cacheKey=componentName+':'+propName;48if(!manualPropTypeCallCache[cacheKey]){49process.env.NODE_ENV!=='production'?warning(false,'You are manually calling a React.PropTypes validation '+'function for the `%s` prop on `%s`. This is deprecated '+'and will not work in production with the next major version. '+'You may be seeing this warning due to a third-party PropTypes '+'library. See https://fb.me/react-warning-dont-call-proptypes '+'for details.',propFullName,componentName):void 0;50manualPropTypeCallCache[cacheKey]=true;51}52}53}54if(props[propName]==null){55var locationName=ReactPropTypeLocationNames[location];56if(isRequired){57if(props[propName]===null){58return new PropTypeError('The '+locationName+' `'+propFullName+'` is marked as required '+('in `'+componentName+'`, but its value is `null`.'));59}60return new PropTypeError('The '+locationName+' `'+propFullName+'` is marked as required in '+('`'+componentName+'`, but its value is `undefined`.'));61}62return null;63}else{64return validate(props,propName,componentName,location,propFullName);65}66}67var chainedCheckType=checkType.bind(null,false);68chainedCheckType.isRequired=checkType.bind(null,true);69return chainedCheckType;70}71function createPrimitiveTypeChecker(expectedType){72function validate(props,propName,componentName,location,propFullName,secret){73var propValue=props[propName];74var propType=getPropType(propValue);75if(propType!==expectedType){76var locationName=ReactPropTypeLocationNames[location];77var preciseType=getPreciseType(propValue);78return new PropTypeError('Invalid '+locationName+' `'+propFullName+'` of type '+('`'+preciseType+'` supplied to `'+componentName+'`, expected ')+('`'+expectedType+'`.'));79}80return null;81}82return createChainableTypeChecker(validate);83}84function createAnyTypeChecker(){85return createChainableTypeChecker(emptyFunction.thatReturns(null));86}87function createArrayOfTypeChecker(typeChecker){88function validate(props,propName,componentName,location,propFullName){89if(typeof typeChecker!=='function'){90return new PropTypeError('Property `'+propFullName+'` of component `'+componentName+'` has invalid PropType notation inside arrayOf.');91}92var propValue=props[propName];93if(!Array.isArray(propValue)){94var locationName=ReactPropTypeLocationNames[location];95var propType=getPropType(propValue);96return new PropTypeError('Invalid '+locationName+' `'+propFullName+'` of type '+('`'+propType+'` supplied to `'+componentName+'`, expected an array.'));97}98for(var i=0;i<propValue.length;i++){99var error=typeChecker(propValue,i,componentName,location,propFullName+'['+i+']',ReactPropTypesSecret);100if(error instanceof Error){101return error;102}103}104return null;105}106return createChainableTypeChecker(validate);107}108function createElementTypeChecker(){109function validate(props,propName,componentName,location,propFullName){110var propValue=props[propName];111if(!ReactElement.isValidElement(propValue)){112var locationName=ReactPropTypeLocationNames[location];113var propType=getPropType(propValue);114return new PropTypeError('Invalid '+locationName+' `'+propFullName+'` of type '+('`'+propType+'` supplied to `'+componentName+'`, expected a single ReactElement.'));115}116return null;117}118return createChainableTypeChecker(validate);119}120function createInstanceTypeChecker(expectedClass){121function validate(props,propName,componentName,location,propFullName){122if(!(props[propName]instanceof expectedClass)){123var locationName=ReactPropTypeLocationNames[location];124var expectedClassName=expectedClass.name||ANONYMOUS;125var actualClassName=getClassName(props[propName]);126return new PropTypeError('Invalid '+locationName+' `'+propFullName+'` of type '+('`'+actualClassName+'` supplied to `'+componentName+'`, expected ')+('instance of `'+expectedClassName+'`.'));127}128return null;129}130return createChainableTypeChecker(validate);131}132function createEnumTypeChecker(expectedValues){133if(!Array.isArray(expectedValues)){134process.env.NODE_ENV!=='production'?warning(false,'Invalid argument supplied to oneOf, expected an instance of array.'):void 0;135return emptyFunction.thatReturnsNull;136}137function validate(props,propName,componentName,location,propFullName){138var propValue=props[propName];139for(var i=0;i<expectedValues.length;i++){140if(is(propValue,expectedValues[i])){141return null;142}143}144var locationName=ReactPropTypeLocationNames[location];145var valuesString=JSON.stringify(expectedValues);146return new PropTypeError('Invalid '+locationName+' `'+propFullName+'` of value `'+propValue+'` '+('supplied to `'+componentName+'`, expected one of '+valuesString+'.'));147}148return createChainableTypeChecker(validate);149}150function createObjectOfTypeChecker(typeChecker){151function validate(props,propName,componentName,location,propFullName){152if(typeof typeChecker!=='function'){153return new PropTypeError('Property `'+propFullName+'` of component `'+componentName+'` has invalid PropType notation inside objectOf.');154}155var propValue=props[propName];156var propType=getPropType(propValue);157if(propType!=='object'){158var locationName=ReactPropTypeLocationNames[location];159return new PropTypeError('Invalid '+locationName+' `'+propFullName+'` of type '+('`'+propType+'` supplied to `'+componentName+'`, expected an object.'));160}161for(var key in propValue){162if(propValue.hasOwnProperty(key)){163var error=typeChecker(propValue,key,componentName,location,propFullName+'.'+key,ReactPropTypesSecret);164if(error instanceof Error){165return error;166}167}168}169return null;170}171return createChainableTypeChecker(validate);172}173function createUnionTypeChecker(arrayOfTypeCheckers){174if(!Array.isArray(arrayOfTypeCheckers)){175process.env.NODE_ENV!=='production'?warning(false,'Invalid argument supplied to oneOfType, expected an instance of array.'):void 0;176return emptyFunction.thatReturnsNull;177}178function validate(props,propName,componentName,location,propFullName){179for(var i=0;i<arrayOfTypeCheckers.length;i++){180var checker=arrayOfTypeCheckers[i];181if(checker(props,propName,componentName,location,propFullName,ReactPropTypesSecret)==null){182return null;183}184}185var locationName=ReactPropTypeLocationNames[location];186return new PropTypeError('Invalid '+locationName+' `'+propFullName+'` supplied to '+('`'+componentName+'`.'));187}188return createChainableTypeChecker(validate);189}190function createNodeChecker(){191function validate(props,propName,componentName,location,propFullName){192if(!isNode(props[propName])){193var locationName=ReactPropTypeLocationNames[location];194return new PropTypeError('Invalid '+locationName+' `'+propFullName+'` supplied to '+('`'+componentName+'`, expected a ReactNode.'));195}196return null;197}198return createChainableTypeChecker(validate);199}200function createShapeTypeChecker(shapeTypes){201function validate(props,propName,componentName,location,propFullName){202var propValue=props[propName];203var propType=getPropType(propValue);204if(propType!=='object'){205var locationName=ReactPropTypeLocationNames[location];206return new PropTypeError('Invalid '+locationName+' `'+propFullName+'` of type `'+propType+'` '+('supplied to `'+componentName+'`, expected `object`.'));207}208for(var key in shapeTypes){209var checker=shapeTypes[key];210if(!checker){211continue;212}213var error=checker(propValue,key,componentName,location,propFullName+'.'+key,ReactPropTypesSecret);214if(error){215return error;216}217}218return null;219}220return createChainableTypeChecker(validate);...
ff496eReactPropTypes.js
Source:ff496eReactPropTypes.js
...29}else{30return x!==x&&y!==y;31}32}33function PropTypeError(message){34this.message=message;35this.stack='';36}37PropTypeError.prototype=Error.prototype;38function createChainableTypeChecker(validate){39if(process.env.NODE_ENV!=='production'){40var manualPropTypeCallCache={};41}42function checkType(isRequired,props,propName,componentName,location,propFullName,secret){43componentName=componentName||ANONYMOUS;44propFullName=propFullName||propName;45if(process.env.NODE_ENV!=='production'){46if(secret!==ReactPropTypesSecret&&typeof console!=='undefined'){47var cacheKey=componentName+':'+propName;48if(!manualPropTypeCallCache[cacheKey]){49process.env.NODE_ENV!=='production'?warning(false,'You are manually calling a React.PropTypes validation '+'function for the `%s` prop on `%s`. This is deprecated '+'and will not work in production with the next major version. '+'You may be seeing this warning due to a third-party PropTypes '+'library. See https://fb.me/react-warning-dont-call-proptypes '+'for details.',propFullName,componentName):void 0;50manualPropTypeCallCache[cacheKey]=true;51}52}53}54if(props[propName]==null){55var locationName=ReactPropTypeLocationNames[location];56if(isRequired){57if(props[propName]===null){58return new PropTypeError('The '+locationName+' `'+propFullName+'` is marked as required '+('in `'+componentName+'`, but its value is `null`.'));59}60return new PropTypeError('The '+locationName+' `'+propFullName+'` is marked as required in '+('`'+componentName+'`, but its value is `undefined`.'));61}62return null;63}else{64return validate(props,propName,componentName,location,propFullName);65}66}67var chainedCheckType=checkType.bind(null,false);68chainedCheckType.isRequired=checkType.bind(null,true);69return chainedCheckType;70}71function createPrimitiveTypeChecker(expectedType){72function validate(props,propName,componentName,location,propFullName,secret){73var propValue=props[propName];74var propType=getPropType(propValue);75if(propType!==expectedType){76var locationName=ReactPropTypeLocationNames[location];77var preciseType=getPreciseType(propValue);78return new PropTypeError('Invalid '+locationName+' `'+propFullName+'` of type '+('`'+preciseType+'` supplied to `'+componentName+'`, expected ')+('`'+expectedType+'`.'));79}80return null;81}82return createChainableTypeChecker(validate);83}84function createAnyTypeChecker(){85return createChainableTypeChecker(emptyFunction.thatReturns(null));86}87function createArrayOfTypeChecker(typeChecker){88function validate(props,propName,componentName,location,propFullName){89if(typeof typeChecker!=='function'){90return new PropTypeError('Property `'+propFullName+'` of component `'+componentName+'` has invalid PropType notation inside arrayOf.');91}92var propValue=props[propName];93if(!Array.isArray(propValue)){94var locationName=ReactPropTypeLocationNames[location];95var propType=getPropType(propValue);96return new PropTypeError('Invalid '+locationName+' `'+propFullName+'` of type '+('`'+propType+'` supplied to `'+componentName+'`, expected an array.'));97}98for(var i=0;i<propValue.length;i++){99var error=typeChecker(propValue,i,componentName,location,propFullName+'['+i+']',ReactPropTypesSecret);100if(error instanceof Error){101return error;102}103}104return null;105}106return createChainableTypeChecker(validate);107}108function createElementTypeChecker(){109function validate(props,propName,componentName,location,propFullName){110var propValue=props[propName];111if(!ReactElement.isValidElement(propValue)){112var locationName=ReactPropTypeLocationNames[location];113var propType=getPropType(propValue);114return new PropTypeError('Invalid '+locationName+' `'+propFullName+'` of type '+('`'+propType+'` supplied to `'+componentName+'`, expected a single ReactElement.'));115}116return null;117}118return createChainableTypeChecker(validate);119}120function createInstanceTypeChecker(expectedClass){121function validate(props,propName,componentName,location,propFullName){122if(!(props[propName]instanceof expectedClass)){123var locationName=ReactPropTypeLocationNames[location];124var expectedClassName=expectedClass.name||ANONYMOUS;125var actualClassName=getClassName(props[propName]);126return new PropTypeError('Invalid '+locationName+' `'+propFullName+'` of type '+('`'+actualClassName+'` supplied to `'+componentName+'`, expected ')+('instance of `'+expectedClassName+'`.'));127}128return null;129}130return createChainableTypeChecker(validate);131}132function createEnumTypeChecker(expectedValues){133if(!Array.isArray(expectedValues)){134process.env.NODE_ENV!=='production'?warning(false,'Invalid argument supplied to oneOf, expected an instance of array.'):void 0;135return emptyFunction.thatReturnsNull;136}137function validate(props,propName,componentName,location,propFullName){138var propValue=props[propName];139for(var i=0;i<expectedValues.length;i++){140if(is(propValue,expectedValues[i])){141return null;142}143}144var locationName=ReactPropTypeLocationNames[location];145var valuesString=JSON.stringify(expectedValues);146return new PropTypeError('Invalid '+locationName+' `'+propFullName+'` of value `'+propValue+'` '+('supplied to `'+componentName+'`, expected one of '+valuesString+'.'));147}148return createChainableTypeChecker(validate);149}150function createObjectOfTypeChecker(typeChecker){151function validate(props,propName,componentName,location,propFullName){152if(typeof typeChecker!=='function'){153return new PropTypeError('Property `'+propFullName+'` of component `'+componentName+'` has invalid PropType notation inside objectOf.');154}155var propValue=props[propName];156var propType=getPropType(propValue);157if(propType!=='object'){158var locationName=ReactPropTypeLocationNames[location];159return new PropTypeError('Invalid '+locationName+' `'+propFullName+'` of type '+('`'+propType+'` supplied to `'+componentName+'`, expected an object.'));160}161for(var key in propValue){162if(propValue.hasOwnProperty(key)){163var error=typeChecker(propValue,key,componentName,location,propFullName+'.'+key,ReactPropTypesSecret);164if(error instanceof Error){165return error;166}167}168}169return null;170}171return createChainableTypeChecker(validate);172}173function createUnionTypeChecker(arrayOfTypeCheckers){174if(!Array.isArray(arrayOfTypeCheckers)){175process.env.NODE_ENV!=='production'?warning(false,'Invalid argument supplied to oneOfType, expected an instance of array.'):void 0;176return emptyFunction.thatReturnsNull;177}178function validate(props,propName,componentName,location,propFullName){179for(var i=0;i<arrayOfTypeCheckers.length;i++){180var checker=arrayOfTypeCheckers[i];181if(checker(props,propName,componentName,location,propFullName,ReactPropTypesSecret)==null){182return null;183}184}185var locationName=ReactPropTypeLocationNames[location];186return new PropTypeError('Invalid '+locationName+' `'+propFullName+'` supplied to '+('`'+componentName+'`.'));187}188return createChainableTypeChecker(validate);189}190function createNodeChecker(){191function validate(props,propName,componentName,location,propFullName){192if(!isNode(props[propName])){193var locationName=ReactPropTypeLocationNames[location];194return new PropTypeError('Invalid '+locationName+' `'+propFullName+'` supplied to '+('`'+componentName+'`, expected a ReactNode.'));195}196return null;197}198return createChainableTypeChecker(validate);199}200function createShapeTypeChecker(shapeTypes){201function validate(props,propName,componentName,location,propFullName){202var propValue=props[propName];203var propType=getPropType(propValue);204if(propType!=='object'){205var locationName=ReactPropTypeLocationNames[location];206return new PropTypeError('Invalid '+locationName+' `'+propFullName+'` of type `'+propType+'` '+('supplied to `'+componentName+'`, expected `object`.'));207}208for(var key in shapeTypes){209var checker=shapeTypes[key];210if(!checker){211continue;212}213var error=checker(propValue,key,componentName,location,propFullName+'.'+key,ReactPropTypesSecret);214if(error){215return error;216}217}218return null;219}220return createChainableTypeChecker(validate);...
aa8713ReactPropTypes.js
Source:aa8713ReactPropTypes.js
...29}else{30return x!==x&&y!==y;31}32}33function PropTypeError(message){34this.message=message;35this.stack='';36}37PropTypeError.prototype=Error.prototype;38function createChainableTypeChecker(validate){39if(process.env.NODE_ENV!=='production'){40var manualPropTypeCallCache={};41}42function checkType(isRequired,props,propName,componentName,location,propFullName,secret){43componentName=componentName||ANONYMOUS;44propFullName=propFullName||propName;45if(process.env.NODE_ENV!=='production'){46if(secret!==ReactPropTypesSecret&&typeof console!=='undefined'){47var cacheKey=componentName+':'+propName;48if(!manualPropTypeCallCache[cacheKey]){49process.env.NODE_ENV!=='production'?warning(false,'You are manually calling a React.PropTypes validation '+'function for the `%s` prop on `%s`. This is deprecated '+'and will not work in production with the next major version. '+'You may be seeing this warning due to a third-party PropTypes '+'library. See https://fb.me/react-warning-dont-call-proptypes '+'for details.',propFullName,componentName):void 0;50manualPropTypeCallCache[cacheKey]=true;51}52}53}54if(props[propName]==null){55var locationName=ReactPropTypeLocationNames[location];56if(isRequired){57if(props[propName]===null){58return new PropTypeError('The '+locationName+' `'+propFullName+'` is marked as required '+('in `'+componentName+'`, but its value is `null`.'));59}60return new PropTypeError('The '+locationName+' `'+propFullName+'` is marked as required in '+('`'+componentName+'`, but its value is `undefined`.'));61}62return null;63}else{64return validate(props,propName,componentName,location,propFullName);65}66}67var chainedCheckType=checkType.bind(null,false);68chainedCheckType.isRequired=checkType.bind(null,true);69return chainedCheckType;70}71function createPrimitiveTypeChecker(expectedType){72function validate(props,propName,componentName,location,propFullName,secret){73var propValue=props[propName];74var propType=getPropType(propValue);75if(propType!==expectedType){76var locationName=ReactPropTypeLocationNames[location];77var preciseType=getPreciseType(propValue);78return new PropTypeError('Invalid '+locationName+' `'+propFullName+'` of type '+('`'+preciseType+'` supplied to `'+componentName+'`, expected ')+('`'+expectedType+'`.'));79}80return null;81}82return createChainableTypeChecker(validate);83}84function createAnyTypeChecker(){85return createChainableTypeChecker(emptyFunction.thatReturns(null));86}87function createArrayOfTypeChecker(typeChecker){88function validate(props,propName,componentName,location,propFullName){89if(typeof typeChecker!=='function'){90return new PropTypeError('Property `'+propFullName+'` of component `'+componentName+'` has invalid PropType notation inside arrayOf.');91}92var propValue=props[propName];93if(!Array.isArray(propValue)){94var locationName=ReactPropTypeLocationNames[location];95var propType=getPropType(propValue);96return new PropTypeError('Invalid '+locationName+' `'+propFullName+'` of type '+('`'+propType+'` supplied to `'+componentName+'`, expected an array.'));97}98for(var i=0;i<propValue.length;i++){99var error=typeChecker(propValue,i,componentName,location,propFullName+'['+i+']',ReactPropTypesSecret);100if(error instanceof Error){101return error;102}103}104return null;105}106return createChainableTypeChecker(validate);107}108function createElementTypeChecker(){109function validate(props,propName,componentName,location,propFullName){110var propValue=props[propName];111if(!ReactElement.isValidElement(propValue)){112var locationName=ReactPropTypeLocationNames[location];113var propType=getPropType(propValue);114return new PropTypeError('Invalid '+locationName+' `'+propFullName+'` of type '+('`'+propType+'` supplied to `'+componentName+'`, expected a single ReactElement.'));115}116return null;117}118return createChainableTypeChecker(validate);119}120function createInstanceTypeChecker(expectedClass){121function validate(props,propName,componentName,location,propFullName){122if(!(props[propName]instanceof expectedClass)){123var locationName=ReactPropTypeLocationNames[location];124var expectedClassName=expectedClass.name||ANONYMOUS;125var actualClassName=getClassName(props[propName]);126return new PropTypeError('Invalid '+locationName+' `'+propFullName+'` of type '+('`'+actualClassName+'` supplied to `'+componentName+'`, expected ')+('instance of `'+expectedClassName+'`.'));127}128return null;129}130return createChainableTypeChecker(validate);131}132function createEnumTypeChecker(expectedValues){133if(!Array.isArray(expectedValues)){134process.env.NODE_ENV!=='production'?warning(false,'Invalid argument supplied to oneOf, expected an instance of array.'):void 0;135return emptyFunction.thatReturnsNull;136}137function validate(props,propName,componentName,location,propFullName){138var propValue=props[propName];139for(var i=0;i<expectedValues.length;i++){140if(is(propValue,expectedValues[i])){141return null;142}143}144var locationName=ReactPropTypeLocationNames[location];145var valuesString=JSON.stringify(expectedValues);146return new PropTypeError('Invalid '+locationName+' `'+propFullName+'` of value `'+propValue+'` '+('supplied to `'+componentName+'`, expected one of '+valuesString+'.'));147}148return createChainableTypeChecker(validate);149}150function createObjectOfTypeChecker(typeChecker){151function validate(props,propName,componentName,location,propFullName){152if(typeof typeChecker!=='function'){153return new PropTypeError('Property `'+propFullName+'` of component `'+componentName+'` has invalid PropType notation inside objectOf.');154}155var propValue=props[propName];156var propType=getPropType(propValue);157if(propType!=='object'){158var locationName=ReactPropTypeLocationNames[location];159return new PropTypeError('Invalid '+locationName+' `'+propFullName+'` of type '+('`'+propType+'` supplied to `'+componentName+'`, expected an object.'));160}161for(var key in propValue){162if(propValue.hasOwnProperty(key)){163var error=typeChecker(propValue,key,componentName,location,propFullName+'.'+key,ReactPropTypesSecret);164if(error instanceof Error){165return error;166}167}168}169return null;170}171return createChainableTypeChecker(validate);172}173function createUnionTypeChecker(arrayOfTypeCheckers){174if(!Array.isArray(arrayOfTypeCheckers)){175process.env.NODE_ENV!=='production'?warning(false,'Invalid argument supplied to oneOfType, expected an instance of array.'):void 0;176return emptyFunction.thatReturnsNull;177}178function validate(props,propName,componentName,location,propFullName){179for(var i=0;i<arrayOfTypeCheckers.length;i++){180var checker=arrayOfTypeCheckers[i];181if(checker(props,propName,componentName,location,propFullName,ReactPropTypesSecret)==null){182return null;183}184}185var locationName=ReactPropTypeLocationNames[location];186return new PropTypeError('Invalid '+locationName+' `'+propFullName+'` supplied to '+('`'+componentName+'`.'));187}188return createChainableTypeChecker(validate);189}190function createNodeChecker(){191function validate(props,propName,componentName,location,propFullName){192if(!isNode(props[propName])){193var locationName=ReactPropTypeLocationNames[location];194return new PropTypeError('Invalid '+locationName+' `'+propFullName+'` supplied to '+('`'+componentName+'`, expected a ReactNode.'));195}196return null;197}198return createChainableTypeChecker(validate);199}200function createShapeTypeChecker(shapeTypes){201function validate(props,propName,componentName,location,propFullName){202var propValue=props[propName];203var propType=getPropType(propValue);204if(propType!=='object'){205var locationName=ReactPropTypeLocationNames[location];206return new PropTypeError('Invalid '+locationName+' `'+propFullName+'` of type `'+propType+'` '+('supplied to `'+componentName+'`, expected `object`.'));207}208for(var key in shapeTypes){209var checker=shapeTypes[key];210if(!checker){211continue;212}213var error=checker(propValue,key,componentName,location,propFullName+'.'+key,ReactPropTypesSecret);214if(error){215return error;216}217}218return null;219}220return createChainableTypeChecker(validate);...
Using AI Code Generation
1const { Playwright } = require('playwright');2const playwright = new Playwright();3const browser = await playwright.chromium.launch();4const page = await browser.newPage();5await page.click('text=Get started');6await page.click('text=API');7await page.click('text=Click me');8await browser.close();9const { Playwright } = require('playwright');10const playwright = new Playwright();11const browser = await playwright.chromium.launch();12const page = await browser.newPage();13await page.click('text=Get started');14await page.click('text=API');15try {16 await page.click('text=Click me');17} catch (error) {18 console.log(error.message);19}20await browser.close();
Using AI Code Generation
1const { PlaywrightInternal } = require('playwright-core/lib/server/playwright');2const { PropTypeError } = PlaywrightInternal;3const { assert } = require('console');4assert.throws(() => { throw new PropTypeError('test', 'test', 'test') }, Error);5assert.throws(() => { throw new PropTypeError('test', 'test', 'test') }, /test/);6assert.throws(() => { throw new PropTypeError('test', 'test', 'test') }, /test/, 'test');7assert.throws(() => { throw new PropTypeError('test', 'test', 'test') }, /test/, 'test', 'test');8assert.throws(() => { throw new PropTypeError('test', 'test', 'test') }, Error, 'test');9const { PlaywrightInternal } = require('playwright-core/lib/server/playwright');10const { PropTypeError } = PlaywrightInternal;11const { assert } = require('assert');12assert.throws(() => { throw new PropTypeError('test', 'test', 'test') }, Error);13assert.throws(() => { throw new PropTypeError('test', 'test', 'test') }, /test/);14assert.throws(() => { throw new PropTypeError('test', 'test', 'test') }, /test/, 'test');15assert.throws(() => { throw new PropTypeError('test', 'test', 'test') }, /test/, 'test', 'test');16assert.throws(() => { throw new PropTypeError('test', 'test', 'test') }, Error, 'test');17const { PlaywrightInternal } = require('playwright-core/lib/server/playwright');18const { PropTypeError } = PlaywrightInternal;19const { assert } = require('assert');20assert.throws(() => { throw new PropTypeError('test', 'test', 'test') }, Error);21assert.throws(() => { throw new PropTypeError('test', 'test', 'test') }, /test/);22assert.throws(() => { throw new PropTypeError('test', 'test', 'test') }, /test/, 'test');23assert.throws(() => { throw new PropTypeError('test', 'test', 'test') }, /test/, 'test', 'test');
Using AI Code Generation
1const { Playwright } = require('playwright-core');2const { PropTypeError } = Playwright.InternalError;3const { expect } = require('chai');4describe('Test', () => {5 it('test', async () => {6 expect(() => {7 throw new PropTypeError('test', 'string', 'number');8 }).to.throw('test');9 });10});11const { Playwright } = require('playwright-core');12const { PropTypeError } = Playwright.InternalError;13const { expect } = require('chai');14describe('Test', () => {15 it('test', async () => {16 expect(() => {17 throw new PropTypeError('test', 'string', 'number');18 }).to.throw('test');19 });20});21const { Playwright } = require('playwright-core');22const { expect } = require('chai');23describe('Test', () => {24 it('test', async () => {25 expect(() => {26 throw new Playwright.InternalError.PropTypeError('test', 'string', 'number');27 }).to.throw('test');28 });29});30const { Playwright } = require('playwright-core');31const { expect } = require('chai');32describe('Test', () => {33 it('test', async () => {34 expect(() => {35 throw new Playwright.InternalError().PropTypeError('test', 'string', 'number');36 }).to.throw('test');37 });38});39const { Playwright } = require('playwright-core');40const { expect } = require('chai');41describe('Test', () => {42 it('test', async () => {43 expect(() => {44 throw new Playwright.InternalError.PropTypeError('test', 'string', 'number');45 }).to.throw('test');46 });47});
Using AI Code Generation
1const { Error } = require('playwright');2const { PropTypeError } = Error;3const { expect } = require('chai');4const { test, expect: expectPlaywright } = require('@playwright/test');5test('should throw error', async ({ page }) => {6 expectPlaywright(page).toHaveSelector('input');7 expect(() => expect(page).toHaveSelector('input')).to.throw(PropTypeError);8});9module.exports = {10 {11 use: {12 viewport: { width: 1280, height: 720 },13 },14 },15};
Using AI Code Generation
1const { PropTypeError } = require('playwright/lib/utils/stackTrace');2const { assert } = require('chai');3const { expect } = require('chai');4const { PropTypeError } = require('playwright/lib/utils/stackTrace');5const { assert } = require('chai');6const { expect } = require('chai');7const { PropTypeError } = require('playwright/lib/utils/stackTrace');8const { assert } = require('chai');9const { expect } = require('chai');10const { PropTypeError } = require('playwright/lib/utils/stackTrace');11const { assert } = require('chai');12const { expect } = require('chai');13const { PropTypeError } = require('playwright/lib/utils/stackTrace');14const { assert } = require('chai');15const { expect } = require('chai');16const { PropTypeError } = require('playwright/lib/utils/stackTrace');17const { assert } = require('chai');18const { expect } = require('chai');19const { PropTypeError } = require('playwright/lib/utils/stackTrace');20const { assert } = require('chai');21const { expect } = require('chai');22const { PropTypeError } = require('playwright/lib/utils/stackTrace');23const { assert } = require('chai');24const { expect } = require('chai');25const { PropTypeError } = require('playwright/lib/utils/stackTrace');26const { assert } = require('chai');27const { expect } = require('chai');28const { PropTypeError } = require('playwright/lib/utils/stackTrace');29const { assert } = require('chai');30const { expect } = require('chai');31const { PropTypeError } = require('playwright/lib/utils/stackTrace');32const { assert } = require('chai');33const {
Using AI Code Generation
1import { PropTypeError } from 'playwright-core/lib/utils/utils';2import { test, expect } from '@playwright/test';3const { PropTypeError } = require('playwright-core/lib/utils/utils');4test('my test', async ({ page }) => {5 await expect(page.locator('text="Get Started"')).toBeVisible();6 await expect(page.locator('text="Get Started"')).toHaveText('Get Started');7 await expect(page.locator('text="Get Started"')).toHaveAttribute('href', '
Using AI Code Generation
1const { Playwright } = require('@playwright/test');2const { PropTypeError } = Playwright.internal;3function test() {4throw new PropTypeError('test', 'string', 123);5}6test();7const { Playwright } = require('@playwright/test');8const { PropTypeError } = Playwright.internal;9function test() {10throw new PropTypeError('test', 'string', 123);11}12test();13const { Playwright } = require('@playwright/test');14const { PropTypeError } = Playwright.internal;15function test() {16throw new PropTypeError('test', 'string', 123);17}18test();19const { Playwright } = require('@playwright/test');20const { PropTypeError } = Playwright.internal;21function test() {22throw new PropTypeError('test', 'string', 123);23}24test();25const { Playwright } = require('@playwright/test');26const { PropTypeError } = Playwright.internal;27function test() {28throw new PropTypeError('test', 'string', 123);29}30test();31const { Playwright } = require('@playwright/test');32const { PropTypeError } = Playwright.internal;33function test() {34throw new PropTypeError('test', 'string', 123);35}36test();37const { Playwright } = require('@playwright/test');38const { PropTypeError } = Playwright.internal;39function test() {40throw new PropTypeError('test', 'string', 123);41}42test();
Using AI Code Generation
1import { Playwright } from "playwright";2const playwright = new Playwright();3const propTypeError = playwright._internalApi.propTypeError;4console.log(propTypeError);5const validateBrowserContextOptions = playwright._internalApi.validateBrowserContextOptions;6console.log(validateBrowserContextOptions);7const validateBrowserOptions = playwright._internalApi.validateBrowserOptions;8console.log(validateBrowserOptions);9const validateBrowserTypeOptions = playwright._internalApi.validateBrowserTypeOptions;10console.log(validateBrowserTypeOptions);11const validateConnectOptions = playwright._internalApi.validateConnectOptions;12console.log(validateConnectOptions);13const validateLaunchOptions = playwright._internalApi.validateLaunchOptions;14console.log(validateLaunchOptions);15const validatePageOptions = playwright._internalApi.validatePageOptions;16console.log(validatePageOptions);17const validateProxySettings = playwright._internalApi.validateProxySettings;18console.log(validateProxySettings);19const validateTimeoutOptions = playwright._internalApi.validateTimeoutOptions;20console.log(validateTimeoutOptions);21const validateViewport = playwright._internalApi.validateViewport;22console.log(validateViewport);23const validateWaitForOptions = playwright._internalApi.validateWaitForOptions;24console.log(validateWaitForOptions);
LambdaTest’s Playwright tutorial will give you a broader idea about the Playwright automation framework, its unique features, and use cases with examples to exceed your understanding of Playwright testing. This tutorial will give A to Z guidance, from installing the Playwright framework to some best practices and advanced concepts.
Get 100 minutes of automation test minutes FREE!!