-
Notifications
You must be signed in to change notification settings - Fork 94
Migrate to TypeScript #105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
54 commits
Select commit
Hold shift + click to select a range
d068194
rename files to TS
Khartir 5665d4a
convert react-async to TS
Khartir 797ef86
add linting for TS
Khartir c22687b
remove old types
Khartir 3381fbe
Merge branch 'next' into switch-to-ts
ghengeveld 5c9d146
fix storybook
Khartir 89b1c08
rge branch 'next' into switch-to-ts
Khartir 0321c69
add @pika/plugin-bundle-types
phryneas 70393af
hotfix for type generation
phryneas 5d545c9
add missing exports, lint
phryneas 6aaa045
prevent multiple different typescript versions to be installed
phryneas 65eebf3
move common types to types.ts
phryneas d370e89
jest config: also transform tsx files
phryneas 430f7c3
readability of globalScope
phryneas f3d2284
move inline typecast to variable
phryneas 2e5333c
better typings for createInstance and default Async
phryneas 436e49b
remove unneccesary genererics
phryneas 8dd1086
remove accidental types
phryneas e08b6ed
inline nullify into render
phryneas d709416
wildcard-export all types
phryneas 9c5d5ce
introduce ReducerAsyncState type, type promise as optional undefined
phryneas e320bb2
Merge branch 'next' into switch-to-ts
Khartir 663b060
remove unused imports
Khartir 0512a0c
fix react being included in types rollup
Khartir a978568
fix enum names
Khartir 825c9ba
implements MockAbortController
Khartir 850aab7
set default options
Khartir ade7fe1
set types for fetch-callback
Khartir ca118fe
Fix failing test
Khartir 306befa
Match propTypes to TS-types
Khartir c40d5d8
add tests for helpers with missing state
Khartir 2cb5c78
prevent Async context consumers to be used outside of Async components
ef8deff
alias AsyncState<T> & AsyncConstructor<T> for readability
8ccfc0f
move MockAbortController out and also use it in Async component
e95a542
Revert "Allow overriding the 'resource' argument of 'fetch' when invo…
Khartir e73b0e0
Merge branch 'next' into switch-to-ts
Khartir bf9d08a
Reapply #150
Khartir f6245df
fix typo
Khartir bce7795
cleanup config
Khartir 8bbcec4
remove yarn.lock
Khartir 4e04af2
remove TS-dependency in package
Khartir 7d55881
remove resolutions
Khartir 3dc3fc1
update pika-packages
Khartir 372c536
update dependencies
Khartir 326b3bd
fix test
Khartir caf3b5d
remove dependency of react-async to fix chromatic
Khartir c8f99ed
Merge remote-tracking branch 'origin/next' into switch-to-ts
phryneas c23f462
add typescript as a dev dependency
phryneas 46bbabb
fix resolutions for tests that switch react versions
phryneas 638a1ee
add umd build, add fields for module, unpkgs, jsdelivr to final packa…
phryneas 3f7c51c
Merge remote-tracking branch 'origin/next' into switch-to-ts
phryneas 3bc18ce
Apply suggestions from code review
phryneas b4cbfd4
Merge branch 'next' into pr/Khartir/105
ghengeveld 9a50543
Bump dependencies.
ghengeveld File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,12 @@ | ||
module.exports = async ({ config }) => { | ||
delete config.module.rules[0].include | ||
config.module.rules.push({ | ||
test: /\.(ts|tsx)$/, | ||
loader: require.resolve('babel-loader'), | ||
options: { | ||
presets: [['react-app', { flow: false, typescript: true }]], | ||
}, | ||
}); | ||
config.resolve.extensions.push('.ts', '.tsx'); | ||
return config | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
module.exports = { | ||
presets: ["@babel/preset-react"], | ||
plugins: ["@babel/plugin-proposal-object-rest-spread"], | ||
plugins: ["@babel/plugin-proposal-object-rest-spread", "@babel/plugin-proposal-class-properties"], | ||
|
||
env: { | ||
test: { | ||
presets: ["@babel/preset-env", "@babel/preset-react"], | ||
plugins: ["@babel/plugin-transform-runtime"], | ||
presets: ["@babel/preset-env", "@babel/preset-react", "@babel/preset-typescript"], | ||
ghengeveld marked this conversation as resolved.
Show resolved
Hide resolved
|
||
plugins: ["@babel/plugin-transform-runtime", "@babel/plugin-proposal-class-properties"], | ||
}, | ||
}, | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't want to add a dependency on class properties, because it will force users to have the same babel config. It's not as commonly available as rest spread. Static class properties can be easily avoided by doing
ClassName.method = ...
outside of the class definition.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It isn't.
TypeScript transpiles class-properties away completely - we use babel only for the tests, so this is only a dependency for running the tests.