Skip to content
This repository has been archived by the owner on Jul 25, 2018. It is now read-only.

Commit

Permalink
fix(template): R.head and R.last should return string type if input i…
Browse files Browse the repository at this point in the history
…s a string
  • Loading branch information
ikatyang committed Jun 28, 2017
1 parent 87289b0 commit 64cd511
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 8 deletions.
8 changes: 6 additions & 2 deletions ramda/dist/src/head.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ import { List } from "./$types";
*/
declare const head: head_0;
type head_0 = {
<T>(list: List<T>): head_1<T>;
(str: string): head_string_1;
<$SEL extends "1", $KIND extends "string">(): (str: string) => head_string_1;
<$SEL extends "1", $KIND extends "list">(): <T>(list: List<T>) => head_list_1<T>;
<T>(list: List<T>): head_list_1<T>;
};
type head_1<T> = T | undefined;
type head_string_1 = string;
type head_list_1<T> = T | undefined;
export = head;
8 changes: 6 additions & 2 deletions ramda/dist/src/last.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ import { List } from "./$types";
*/
declare const last: last_0;
type last_0 = {
<T>(list: List<T>): last_1<T>;
(str: string): last_string_1;
<$SEL extends "1", $KIND extends "string">(): (str: string) => last_string_1;
<$SEL extends "1", $KIND extends "list">(): <T>(list: List<T>) => last_list_1<T>;
<T>(list: List<T>): last_list_1<T>;
};
type last_1<T> = T | undefined;
type last_string_1 = string;
type last_list_1<T> = T | undefined;
export = last;
3 changes: 2 additions & 1 deletion templates/head.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import {List} from './$types';

export function $<T>(list: List<T>): T | undefined;
export function $string(str: string): string;
export function $list<T>(list: List<T>): T | undefined;
3 changes: 2 additions & 1 deletion templates/last.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import {List} from './$types';

export function $<T>(list: List<T>): T | undefined;
export function $string(str: string): string;
export function $list<T>(list: List<T>): T | undefined;
2 changes: 1 addition & 1 deletion tests/__snapshots__/head.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

exports[`R_head(number_array) 1`] = `"number | undefined"`;

exports[`R_head(string) 1`] = `"string | undefined"`;
exports[`R_head(string) 1`] = `"string"`;

exports[`R_head(string_array) 1`] = `"string | undefined"`;
2 changes: 1 addition & 1 deletion tests/__snapshots__/last.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

exports[`R_last(number_array) 1`] = `"number | undefined"`;

exports[`R_last(string) 1`] = `"string | undefined"`;
exports[`R_last(string) 1`] = `"string"`;

exports[`R_last(string_array) 1`] = `"string | undefined"`;

0 comments on commit 64cd511

Please sign in to comment.