Skip to content

Commit

Permalink
chore: Add return type annotations to generatorParameters and fsrs fu…
Browse files Browse the repository at this point in the history
…nctions
  • Loading branch information
2Lavine authored and ishiko732 committed Nov 3, 2023
1 parent 9d3c71a commit e212271
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/fsrs/default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const default_enable_fuzz = envParams.FSRS_ENABLE_FUZZ || false;

export const FSRSVersion: string = "3.0.4";

export const generatorParameters = (props?: Partial<FSRSParameters>) => {
export const generatorParameters = (props?: Partial<FSRSParameters>): FSRSParameters => {
return {
request_retention: props?.request_retention || default_request_retention,
maximum_interval: props?.maximum_interval || default_maximum_interval,
Expand All @@ -54,6 +54,6 @@ export const createEmptyCard = (now?: Date): Card => {
};
};

export const fsrs = (params?: Partial<FSRSParameters>) => {
export const fsrs = (params?: Partial<FSRSParameters>): FSRS => {
return new FSRS(params || {});
};
4 changes: 2 additions & 2 deletions src/fsrs/fsrs.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { SchedulingCard } from "./index";
import { fixDate, fixState } from "./help";
import { FSRSParameters, Card, State, CardInput, DateInput } from "./models";
import { FSRSParameters, Card, State, CardInput, DateInput, RecordLog } from "./models";
import type { int } from "./type";
import { FSRSAlgorithm } from "./algorithm";

Expand All @@ -20,7 +20,7 @@ export class FSRS extends FSRSAlgorithm {
return { card, now };
}

repeat = (card: CardInput, now: DateInput) => {
repeat = (card: CardInput, now: DateInput): RecordLog => {
const process = this.preProcess(card, now);
card = process.card;
now = process.now;
Expand Down
2 changes: 2 additions & 0 deletions src/fsrs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ export type {
FSRSParameters,
Card,
ReviewLog,
RecordLog,
RecordLogItem,
StateType,
RatingType,
CardInput,
Expand Down

0 comments on commit e212271

Please sign in to comment.