Skip to content

Commit

Permalink
[humanname_v0.2.x] Add libdefs for humanname (#3055)
Browse files Browse the repository at this point in the history
  • Loading branch information
nvie authored and villesau committed Jan 15, 2019
1 parent a22cc82 commit 2c509f0
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
19 changes: 19 additions & 0 deletions definitions/npm/humanname_v0.2.x/flow_v0.25.x-/humanname_v0.2.x.js
@@ -0,0 +1,19 @@
/**
* Flow libdef for 'humanname'
* See https://www.npmjs.com/package/humanname
* by Vincent Driessen, 2018-12-21
*/

declare module 'humanname' {
declare export type HumanName = {|
firstName: string,
lastName: string,
salutation: string,
initials: string,
suffix: string,
|};

declare export default {|
parse: (name: string) => HumanName,
|};
}
19 changes: 19 additions & 0 deletions definitions/npm/humanname_v0.2.x/test_humanname.js
@@ -0,0 +1,19 @@
// @flow strict

import humanname from 'humanname';
import { describe, it } from 'flow-typed-test';

describe('humanname', () => {
it('errors', () => {
// $ExpectError
humanname();
});

it('works', () => {
(humanname.parse('Mr. Foo').firstName: string);
(humanname.parse('Mr. Foo').lastName: string);
(humanname.parse('Mr. Foo').salutation: string);
(humanname.parse('Mr. Foo').initials: string);
(humanname.parse('Mr. Foo').suffix: string);
});
});

0 comments on commit 2c509f0

Please sign in to comment.