Skip to content
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

Adding types, derived from fontawesome API types #46

Merged
merged 21 commits into from
Jan 22, 2018
Merged

Conversation

mlwilkerson
Copy link
Member

@mlwilkerson mlwilkerson commented Dec 28, 2017

This PR depends upon the type definitions being added to the underlying @fortawesome/fontawesome and @fortawesome/fontawesome-free-solid npm packages.

So, for those who may like to see how these work together, I've also attached tarballs with alpha versions of @fortawesome/fontawesome and @fortawesome/fontawesome-free-solid with type definitions.

For any reviewers who'd like to set this up to try it out (like with the example app typescript app I've added to this repo), I recommend that you simply use the attached tarballs as dependencies of react-fontawesome via npm link or yarn link.

fortawesome-fontawesome-1.1.1-alpha3.tar.gz
fortawesome-fontawesome-free-solid-5.0.3-alpha2.tar.gz

[UPDATE 12-29-17: updated alpha tarballs and removed type def listings from this comment, because they got much longer after adding all of the icon names. But you'll find them in the tarballs.]

@mlwilkerson
Copy link
Member Author

This an alternative proposal to PR #33 , but is inspired by the initial work done there by @Aidurber, @PeterKottas, and @mboudreau.

@NateRadebaugh
Copy link
Contributor

I'm excited to take advantage of react-fontawesome using typescript... is there anything I can do to help get this change in?

@mlwilkerson
Copy link
Member Author

Hi @NateRadebaugh. I'm in the midst of finalizing some major work to support TypeScript usages, and expect to release it today or Monday. I think we've got all the resources needed to get that done soon. But when it's out, some feedback after you start using would be great.

@mlwilkerson mlwilkerson changed the base branch from master to development January 22, 2018 14:46
src/index.js Outdated
import fontawesome from '@fortawesome/fontawesome'
import FontAwesomeIcon from './components/FontAwesomeIcon'
import { noAuto } from '@fortawesome/fontawesome'
export { FontAwesomeIcon } from './components/FontAwesomeIcon'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we make this export default as FontAwesomeIcon from './components/FontAwesomeIcon'?

@@ -45,23 +45,23 @@ function normalizeIconArgs (icon) {
}
}

function FontAwesomeIcon (props) {
export function FontAwesomeIcon (props) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My only complaint with this is that I would consider src/components/FontAwesomeIcon.js an internal component. So I would expect there to be a default export in this file. It feels strange to need to do this in the test:

import { FontAwesomeIcon } from '../FontAwesomeIcon'

Can we switch this to export default function (props) {

@mlwilkerson
Copy link
Member Author

@robmadole just pushed changes. Do they satisfy your requests?

Copy link
Member

@robmadole robmadole left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect-o!

@robmadole
Copy link
Member

@mlwilkerson yes, thank you. This looks good-to-go 👍.

@mlwilkerson mlwilkerson merged commit 80fa874 into development Jan 22, 2018
@mlwilkerson mlwilkerson deleted the types branch January 22, 2018 16:57
@mlwilkerson
Copy link
Member Author

UPDATE: A pre-release version with these changes has been published as
@fortawesome/react-fontawesome@0.1.0-1

robmadole pushed a commit that referenced this pull request Feb 15, 2018
* Add TypeScript types, dependent upon the types in the fontawesome API
package.

* Add example app that uses TypeScript

* Add @types/react package to dev dependencies

* Reformat with prettier

* Moving from default imports to named imports, both in how this component uses the underlying fontawesome API, and in what this component exports to its clients.

* Update documentation to remove default export/import.
robmadole pushed a commit that referenced this pull request Mar 28, 2018
* Add TypeScript types, dependent upon the types in the fontawesome API
package.

* Add example app that uses TypeScript

* Add @types/react package to dev dependencies

* Reformat with prettier

* Moving from default imports to named imports, both in how this component uses the underlying fontawesome API, and in what this component exports to its clients.

* Update documentation to remove default export/import.
@asfernandes
Copy link

What about a final release with this?

@robmadole
Copy link
Member

We'll get his released when we feel like it's been tested and matured enough. We aren't there yet.

@kirkbross
Copy link
Contributor

kirkbross commented Apr 26, 2018

Can you release a pre-release which adds color?: string; in index.d.ts?
I'm on 0.1.0-8 right now and I think that's the latest pre-release(?)

@kirkbross
Copy link
Contributor

robmadole pushed a commit that referenced this pull request May 15, 2018
* Add TypeScript types, dependent upon the types in the fontawesome API
package.

* Add example app that uses TypeScript

* Add @types/react package to dev dependencies

* Reformat with prettier

* Moving from default imports to named imports, both in how this component uses the underlying fontawesome API, and in what this component exports to its clients.

* Update documentation to remove default export/import.
robmadole pushed a commit that referenced this pull request Jun 20, 2018
* Add TypeScript types, dependent upon the types in the fontawesome API
package.

* Add example app that uses TypeScript

* Add @types/react package to dev dependencies

* Reformat with prettier

* Moving from default imports to named imports, both in how this component uses the underlying fontawesome API, and in what this component exports to its clients.

* Update documentation to remove default export/import.
robmadole pushed a commit that referenced this pull request Jun 20, 2018
* Add TypeScript types, dependent upon the types in the fontawesome API
package.

* Add example app that uses TypeScript

* Add @types/react package to dev dependencies

* Reformat with prettier

* Moving from default imports to named imports, both in how this component uses the underlying fontawesome API, and in what this component exports to its clients.

* Update documentation to remove default export/import.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants