Repository navigation
Reorganize React definitions - #5579
Conversation
|
This PR was originally meant to not make any real changes to the current functionality (no bugfixes, additions, etc). However, there is one issue that came up which I think we should try to go ahead and bandaid. In fb0b124 an indexer was added to CSSProperties. I believe this was to fix the new strict object literal checking in TS 1.6 which has been causing a lot of PRs lately for missing CSS properties. It did, however, have a side effect of no longer allowing something like this: var style = { whatever: '' };
<div style={style} />The above will throw Changing the indexer from In any case, I've updated this PR to change the indexer to |
|
Just to clarify the indexer thing: another new behavior in 1.6 is that an indexer of type let x = { whatever : '' };
let y: { [s: string]: any };
y = x; // OK in 1.6, error in 1.5 |
|
Out of curiosity, what is the difference between module and namespace? I'm excited to have fewer files. |
|
@pspeter3 It's part of the "internal modules => namespaces, external modules => modules" renaming. In other words: declare namespace Foo { } // works, namespace
declare namespace "Foo" { } // doesn't work
declare module Foo { } // works, namespace
declare module "Foo" { } // works, module |
|
That's awesome and makes the distinction clearer. |
|
um? can I merge this PR? |
|
I feel favorably to it |
|
👍 |
Originally had renamed react-global.d.ts to react-namespace.d.ts. After thinking about it further I don't think a rename really benefits anyone and would just cause confusion with people trying to upgrade. Also I had missed the `.d` in the original rename. Additionally adding some tests for the global version since there were none.
|
I just made some (I think non-controversial) changes.
|
|
If @vsiao @RyanCavanaugh have no objections shall we look to merge? |
Reorganize React definitions
|
Merged. Thanks for your work @jbrantly |
This is a first pass at implementing #5221. This cuts the number of files from 4 to 2 and reduces the "duplicate" definitions from 3 to 2 (both in the same file,
react.d.ts).The number of duplicate definitions can be further reduced once React v0.14 is released.
cc @vsiao @pspeter3 @RyanCavanaugh