|
7 | 7 |
|
8 | 8 | import Transform from 'art/core/transform';
|
9 | 9 | import Mode from 'art/modes/current';
|
10 |
| -import invariant from 'shared/invariant'; |
11 | 10 |
|
12 | 11 | import {TYPES, EVENT_TYPES, childrenAsString} from './ReactARTInternals';
|
13 | 12 |
|
@@ -248,8 +247,7 @@ export * from 'react-reconciler/src/ReactFiberHostConfigWithNoMicrotasks';
|
248 | 247 | export function appendInitialChild(parentInstance, child) {
|
249 | 248 | if (typeof child === 'string') {
|
250 | 249 | // Noop for string children of Text (eg <Text>{'foo'}{'bar'}</Text>)
|
251 |
| - invariant(false, 'Text children should already be flattened.'); |
252 |
| - return; |
| 250 | + throw new Error('Text children should already be flattened.'); |
253 | 251 | }
|
254 | 252 |
|
255 | 253 | child.inject(parentInstance);
|
@@ -282,7 +280,9 @@ export function createInstance(type, props, internalInstanceHandle) {
|
282 | 280 | break;
|
283 | 281 | }
|
284 | 282 |
|
285 |
| - invariant(instance, 'ReactART does not support the type "%s"', type); |
| 283 | + if (!instance) { |
| 284 | + throw new Error(`ReactART does not support the type "${type}"`); |
| 285 | + } |
286 | 286 |
|
287 | 287 | instance._applyProps(instance, props);
|
288 | 288 |
|
@@ -367,18 +367,18 @@ export function appendChildToContainer(parentInstance, child) {
|
367 | 367 | }
|
368 | 368 |
|
369 | 369 | export function insertBefore(parentInstance, child, beforeChild) {
|
370 |
| - invariant( |
371 |
| - child !== beforeChild, |
372 |
| - 'ReactART: Can not insert node before itself', |
373 |
| - ); |
| 370 | + if (child === beforeChild) { |
| 371 | + throw new Error('ReactART: Can not insert node before itself'); |
| 372 | + } |
| 373 | + |
374 | 374 | child.injectBefore(beforeChild);
|
375 | 375 | }
|
376 | 376 |
|
377 | 377 | export function insertInContainerBefore(parentInstance, child, beforeChild) {
|
378 |
| - invariant( |
379 |
| - child !== beforeChild, |
380 |
| - 'ReactART: Can not insert node before itself', |
381 |
| - ); |
| 378 | + if (child === beforeChild) { |
| 379 | + throw new Error('ReactART: Can not insert node before itself'); |
| 380 | + } |
| 381 | + |
382 | 382 | child.injectBefore(beforeChild);
|
383 | 383 | }
|
384 | 384 |
|
@@ -433,25 +433,25 @@ export function clearContainer(container) {
|
433 | 433 | }
|
434 | 434 |
|
435 | 435 | export function getInstanceFromNode(node) {
|
436 |
| - throw new Error('Not yet implemented.'); |
| 436 | + throw new Error('Not implemented.'); |
437 | 437 | }
|
438 | 438 |
|
439 | 439 | export function isOpaqueHydratingObject(value: mixed): boolean {
|
440 |
| - throw new Error('Not yet implemented'); |
| 440 | + throw new Error('Not implemented.'); |
441 | 441 | }
|
442 | 442 |
|
443 | 443 | export function makeOpaqueHydratingObject(
|
444 | 444 | attemptToReadValue: () => void,
|
445 | 445 | ): OpaqueIDType {
|
446 |
| - throw new Error('Not yet implemented.'); |
| 446 | + throw new Error('Not implemented.'); |
447 | 447 | }
|
448 | 448 |
|
449 | 449 | export function makeClientId(): OpaqueIDType {
|
450 |
| - throw new Error('Not yet implemented'); |
| 450 | + throw new Error('Not implemented.'); |
451 | 451 | }
|
452 | 452 |
|
453 | 453 | export function makeClientIdInDEV(warnOnAccessInDEV: () => void): OpaqueIDType {
|
454 |
| - throw new Error('Not yet implemented'); |
| 454 | + throw new Error('Not implemented.'); |
455 | 455 | }
|
456 | 456 |
|
457 | 457 | export function beforeActiveInstanceBlur(internalInstanceHandle: Object) {
|
|
0 commit comments