Skip to content

Commit

Permalink
fix: type errors
Browse files Browse the repository at this point in the history
  • Loading branch information
RebeccaStevens committed Mar 24, 2024
1 parent d9f8916 commit b73bcd2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/rules/no-expression-statements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ function checkExpressionStatement(
returnStatements.every(
(statement) =>
statement.expression !== undefined &&
tsApiUtils.isThisKeyword(statement.expression),
tsApiUtils?.isThisKeyword(statement.expression),
)
) {
return {
Expand Down
3 changes: 2 additions & 1 deletion src/utils/rule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,10 @@ export type RuleDefinition<
MessageIds extends string,
Options extends BaseOptions,
> = {
readonly defaultOptions: Options;
readonly meta: NamedCreateRuleCustomMeta<MessageIds, Options>;
readonly create: (
context: RuleDefinition<MessageIds, Options>,
context: Readonly<RuleContext<MessageIds, Options>>,
) => RuleListener;
};

Expand Down
15 changes: 5 additions & 10 deletions tests/helpers/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,8 @@ export function addFilename<
};
}

export type MessagesOf<
T extends RuleDefinition<string, ReadonlyArray<unknown>>,
> =
T extends RuleDefinition<infer Messages, ReadonlyArray<unknown>>
? Messages
: never;

export type OptionsOf<
T extends RuleDefinition<string, ReadonlyArray<unknown>>,
> = T extends RuleDefinition<string, infer Options> ? Options : never;
export type MessagesOf<T extends RuleDefinition<string, any>> =
T extends RuleDefinition<infer Messages, any> ? Messages : never;

export type OptionsOf<T extends RuleDefinition<string, any>> =
T extends RuleDefinition<string, infer Options> ? Options : never;

0 comments on commit b73bcd2

Please sign in to comment.