Skip to content

Commit

Permalink
fix(types): Change type to allow autocompletion and existence checking (
Browse files Browse the repository at this point in the history
  • Loading branch information
robwalkerco authored and longlho committed Jul 12, 2019
1 parent e4b2187 commit 20d39e6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/define-messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@ import {MessageDescriptor} from './types';
* See the accompanying LICENSE file for terms.
*/

export default function defineMessages(
messageDescriptors: Record<string, MessageDescriptor>
type Messages<Names extends keyof any = string> = {
[key in Names]: MessageDescriptor;
};

export default function defineMessages<Names extends keyof any>(
messageDescriptors: Messages<Names>
) {
// This simply returns what's passed-in because it's meant to be a hook for
// babel-plugin-react-intl.
Expand Down

0 comments on commit 20d39e6

Please sign in to comment.