Skip to content

Commit

Permalink
fix(types): drop undefined for t & lookupAst (#1424)
Browse files Browse the repository at this point in the history
  • Loading branch information
buschtoens committed Aug 20, 2020
1 parent 62e0a0b commit de2f60b
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions addon/services/intl.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ type FormatterProxy<T extends keyof IntlService['_formatters']> = (
formatOptions: Parameters<IntlService['_formatters'][T]['format']>[2]
) => ReturnType<IntlService['_formatters'][T]['format']>;

/**
* By default `utils/intl/missing-message` always returns a string. Users could
* change this. This type is to indicate that some methods just pass through the
* return value of that function.
*/
type MissingMessage = string;

export default class IntlService extends Service.extend(Evented) {
/**
* @public
Expand Down Expand Up @@ -66,12 +73,12 @@ export default class IntlService extends Service.extend(Evented) {
key: string,
localeName?: string | string[],
options?: { resilient: boolean }
): MessageFormatElement[] | undefined;
): MessageFormatElement[] | MissingMessage;

private validateKeys(keys: string[]): void;
private validateKeys(keys: unknown[]): void | never;

t(key: string, options?: TOptions): string | undefined;
t(key: string, options?: TOptions): string | MissingMessage;

exists(key: string, localeName?: string | string[]): boolean;

Expand Down

0 comments on commit de2f60b

Please sign in to comment.