Commit Graph

7118 Commits

Author SHA1 Message Date
Christopher Chedeau f7076b7759 Kill keyOf :) (#7615) 2016-08-30 11:03:05 -07:00
Christopher Chedeau 2f9a9dc4c5 Remove keyMirror in TopLevelTypes (#7597)
This is the last callsite of keyMirror! It removes 0.5k gzipped :)

The only trick with this one is that ReactTestUtils actually iterates over the list of all the events. Instead of duplicating the logic, I used the $Enum feature of flow that lets us statically extract out the type from the dynamic value. Inside of react-dom we're no longer requiring the file directly so it doesn't bloat the file size, and we still get to have static typing, best of both worlds!
2016-08-30 09:50:16 -07:00
Christopher Chedeau 738a9e3ef2 Remove keyMirror in PropagationPhases (#7596)
See rationale in https://www.facebook.com/groups/2003630259862046/permalink/2097088000516271/
2016-08-30 09:44:14 -07:00
Paul O’Shannessy 395888435b Cleanup ReactErrorUtils (#7610)
This cleans up the Flow annotations and brings the implementations in line.
2016-08-29 20:44:47 -07:00
Michael Jackson 9fd42264fe s/npmcdn/unpkg/g (#7609)
npmcdn.com is moving to unpkg.com. Same backend, one less letter in the
domain name. Boom.
2016-08-29 19:45:31 -07:00
Duke Pham 3071f31d04 Add line breaks to examples on 10.1-animation docs per (#7606)
comments to issue #7317.
Updated JP doc examples to match other languages
Reformat to match JSX multi-line style #7550
2016-08-29 15:50:23 -07:00
Robert Kielty ee199381de Adds minor additions clarifying questions I had reading intro tutorial (#7595) 2016-08-29 15:34:48 -07:00
Marcin Mazurek ba84b5b0a7 Warn if input changes controlledness - also for null (#7544) (#7603) 2016-08-29 11:23:30 -07:00
Nick Raienko 5331fd00bc Ignore bundle.js for examples (#7498)
* Ignore bundle.js for examples

* Move ignored bundle.js under examples directory
2016-08-29 10:34:46 -07:00
Clay Miller 3c73463eb1 Remove non-standard 'icon' property (fixes #7430) (#7508) 2016-08-29 10:33:28 -07:00
Nik Nyby 9511b4fe29 docs: re-position comments to account for code sample width (#7602) 2016-08-29 10:08:07 -07:00
TedPowers 8397ef58db Changed to !document.documentMode (#7594) 2016-08-29 04:33:36 -07:00
Christopher Chedeau a3e576e1bb Type Transaction (#7581)
This one is interesting because we have transaction objects being passed around everywhere in the codebase but there's actually no Transaction class. It's a "mixin" that comes to life by being Object.assigned to the prototype of a real "class" (before class was cool!). Therefore, we can't just say `var Transaction = require('Transaction'); (transaction: Transaction) => { }` because it would be the object that contains a mixin and not an instance of a transaction.

The trick I use is to export `TransactionType` and alias it to `Transaction` in the file as it doesn't actually require transaction. In case they do, we'll figure it out, but in the few files I looked at, it doesn't seem to be the case.

For the perform function, it actually typechecks pretty well!
2016-08-28 16:47:27 -07:00
Christopher Chedeau dd0c65c6aa Remove the Mixin layer of indirection on ReactCompositeComponent (#7599)
As mentioned in https://github.com/facebook/react/pull/7581#issuecomment-242952042 we can remove the Mixin layer of indirection as it only exports a Mixin and I find it confusing.
2016-08-28 16:46:53 -07:00
Christopher Chedeau dbe3584340 Remove the Mixin layer of indirection on ReactMultiChild (#7598)
As mentioned in https://github.com/facebook/react/pull/7581#issuecomment-242952042 we can remove the Mixin layer of indirection as it only exports a Mixin and I find it confusing.
2016-08-28 16:46:39 -07:00
Christopher Chedeau 19b8eadb24 Type PooledClass (#7578)
This one was really interesting to type as it's doing a lot of unusual JavaScript. Fortunately flow is now pretty kick ass and I've been able to mostly type it. The only missing piece is that it won't check the constructor arguments.

If you are a fb employee, you can follow the discussion here: https://www.facebook.com/groups/flowtype/permalink/1132359430146004/
2016-08-28 10:43:13 -07:00
Christopher Chedeau fa9869b5a0 Type ReactOwner (#7587)
Incrementally type ReactInstance by adding the types of attach/detachRef.

I moved isValidOwner as a function inside of the file since it's never used externally.
2016-08-28 10:31:49 -07:00
Christopher Chedeau c9e03f0a85 Type ReactMultiChildUpdateTypes (#7589)
As mentioned in https://www.facebook.com/groups/2003630259862046/permalink/2097088000516271/ I'm going to kill this instance of keyMirror and use a plain string instead with a type union.

The current type union is unused right now but when I type ReactMultiChild I will use it.
2016-08-28 10:31:30 -07:00
Christopher Chedeau e3b2c6e650 Remove keyMirror in SpecPolicy (#7590)
As discussed in my RFC: https://www.facebook.com/groups/2003630259862046/permalink/2097088000516271/
2016-08-28 10:30:59 -07:00
Christopher Chedeau a35387c030 Remove keyMirror in ComponentLifeCycle (#7591)
See rationale in https://www.facebook.com/groups/2003630259862046/permalink/2097088000516271/
2016-08-28 10:30:33 -07:00
Christopher Chedeau 84084153ed Remove keyMirror in ReactPropTypeLocations (#7592)
This one involves a bit more work as I added "phantom" flow types to a bunch of places where the type is a ReactPropTypeLocations even though those files are not `@flow` yet.

A good side effect is that `ReactPropTypeLocationNames` keys are now correctly typed, this means that they cannot go out of sync without breaking flow :)
2016-08-28 10:30:15 -07:00
Christopher Chedeau 0d927844fb Type ReactDebugTool (#7586)
Flow doesn't really support the concept of variables that are non-null but only inside of a `__DEV__` block. There's an internal post about it ( https://www.facebook.com/groups/flowtype/permalink/1132437726804841/ ) and the conclusion is that we should force it to be non-null and trust the developer to put the proper DEV checks in place.
2016-08-27 14:13:18 -07:00
Christopher Chedeau 2fb5eae372 Type ReactPerf (#7585)
We need to export FlushHistory type and I submitted a PR on flow to fix the type of console.table which is too restrictive.

I'm already starting to see the benefits of flow, I can look at random variables in the code and flow knows what shape the objects are! It's really useful to try and understand what's going on :)
2016-08-27 14:12:54 -07:00
Christophe Hurpeau 517a0dc051 doc: npm ls react is a better advice (#7513)
Refs Must Have Owner Warning
`npm ls react` is a better advice than `npm ls | grep react`
2016-08-26 23:04:00 -07:00
Christopher Chedeau c086e5f94e Type ReactDebugTool (#7576) 2016-08-26 14:47:59 -07:00
Christopher Chedeau 09887e0311 Type ReactInvalidSetStateWarningHook (#7572) 2016-08-26 14:47:15 -07:00
Christopher Chedeau e2ddbac35e Type ReactChildrenMutationWarningHook (#7571) 2016-08-26 14:46:57 -07:00
Christopher Chedeau b977cf13c4 Remove unneeded declare (#7570)
It turns out that we don't need it, flow is smart enough to realize that the function is declared in the two branches :)
2016-08-26 08:42:03 -07:00
Christopher Chedeau f784a2d50a Type ReactComponentEnvironment (#7566) 2016-08-25 20:08:20 -07:00
Christopher Chedeau 66e77f696a Fix lint errors (#7568)
In Type ReactComponentTreeHook #7504, I merged even though travis didn't report green (travis for all the fb repos has been backlogged like crazy since this morning) by manually doing `npm test` and `npm run flow` but I didn't ensure that lint was all green.

@millermedeiros pinged me about it so here's a quick fix
2016-08-25 19:16:34 -07:00
Miller Medeiros 38f74bcaf4 Support error boundaries on ReactTestRenderer (#7558) 2016-08-25 16:35:55 -06:00
Christopher Chedeau ea494a2c10 Type ReactComponentTreeHook (#7504)
For this one, I wanted to type a non-trivial piece of the codebase and ran into the fact that we do not have types for ReactElement nor ReactInstance, so I had to create them.

I'll add comments inline
2016-08-25 15:27:03 -07:00
Christopher Chedeau 563f3bbab4 Type ReactPropTypesSecret (#7501) 2016-08-25 15:26:38 -07:00
Christopher Chedeau a72a156f58 Type ReactElementSymbol (#7564) 2016-08-25 15:23:29 -07:00
Christopher Chedeau 03e8c0eb75 Type ReactErrorUtils (#7565) 2016-08-25 15:23:13 -07:00
Christopher Chedeau 18003578b1 Type canDefineProperty (#7500) 2016-08-25 10:46:49 -07:00
Christopher Chedeau ad3c65186e Type ReactPropTypeLocations (#7502) 2016-08-25 10:46:26 -07:00
Christopher Chedeau 7f64baad78 Type ReactPropTypeLocationNames (#7503) 2016-08-25 10:46:15 -07:00
Christopher Chedeau 08614db025 Update flow to 0.31 (#7557) 2016-08-25 09:43:28 -07:00
Dan Abramov a229cdba7f Ensure lifecycle timers are stopped on errors (#7548)
* Ensure lifecycle timers are stopped on errors

Fixes #7349

* Address review feedback and add an extra test
2016-08-24 19:18:32 +01:00
Dan Abramov 0a248ee7b9 Show React events in the timeline when ReactPerf is active (#7549)
* Show React events in the timeline when ReactPerf is active

This currently only seems to work on Chrome.

* Address Chrome issue
2016-08-24 18:40:16 +01:00
Paul Kehrer 7b11aa9450 Add playsInline as an allowed HTML property (#7519)
The WHATWG has unprefixed `-webkit-playsinline` as `playsinline` (see: https://github.com/whatwg/html/pull/1444) and iOS 10 intends to use it (https://webkit.org/blog/6784/new-video-policies-for-ios/).
2016-08-23 10:47:51 -07:00
NestorTejero 32e60fecdc add explicit link to http://bower.io/ (#7546) 2016-08-23 09:30:12 -07:00
Lucas 56e20b4ab5 Fix minor typo in README.md (#7540) 2016-08-21 18:36:54 -07:00
Lucas 869cb05b76 Add missing KeyUp eventType (#7533)
Fixes #7222.
2016-08-19 18:03:35 -07:00
Paul O’Shannessy 077d32cebb Update website for 15.3.1
(cherry picked from commit 199056cf1b)
2016-08-19 14:20:02 -07:00
Paul O’Shannessy e10f83de12 Update readme for 15.3.1
(cherry picked from commit cc41ec258f)
2016-08-19 14:20:02 -07:00
Paul O’Shannessy 9af8be654b Update changelog for 15.3.1
(cherry picked from commit 3c0906ca24)
2016-08-19 14:20:01 -07:00
Greg Palmer a8741963dc Avoid "Member not found" error in IE (#7411)
Explanation, discussion, and similar change as #7343

Addresses #7320
2016-08-19 14:43:34 -06:00
Ben Alpert 6a65960641 Improve validateDOMNesting message for whitespace (#7515)
For #5071.
2016-08-19 11:45:14 -07:00