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

chore(typescript): add TypeScript support #54

Merged
merged 6 commits into from Jan 17, 2019

Conversation

Projects
None yet
2 participants
@chitoku-k
Copy link
Contributor

chitoku-k commented Jan 7, 2019

関連:#53
TypeScript の型定義を追加しました。

What:
react-intldefineMessages() にオブジェクトではなく文字列のメッセージを取るオーバーロードを追加しました。

Why:
ユーザーが次のようなコードを書いたときに Babel によるトランスパイル後の状態でエクスポートされるようにするためです。

messages.ts

import { defineMessages } from 'react-intl'
import 'babel-plugin-react-intl-auto'

export default defineMessages({
  hello: 'hello {name}',
  welcome: 'Welcome!',
})

index.tsx

import messages from './messages'

console.log(messages.hello.id)
console.log(messages.hello.defaultMessage)

How:

  • eslint の TypeScript プラグインを追加しました
  • eslint と prettier の対象に型定義を追加しました

Checklist:

  • Documentation
  • Tests
  • Ready to be merged
  • Added myself to contributors table

ドキュメントは別で PR を出します。

chitoku-k and others added some commits Jan 7, 2019

@akameco akameco merged commit d44aebd into akameco:master Jan 17, 2019

0 of 2 checks passed

continuous-integration/appveyor/pr Waiting for AppVeyor build to complete
Details
continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
@akameco

This comment has been minimized.

Copy link
Owner

akameco commented Jan 17, 2019

@chitoku-k Great Job 💯 Thank you :)

@chitoku-k chitoku-k deleted the chitoku-k:feature/typescript branch Jan 17, 2019

@chitoku-k chitoku-k referenced this pull request Jan 27, 2019

Merged

example(typescript): add TypeScript example #57

1 of 4 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.