Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Linting] Fix some violations of no-explicit-any #177

Merged
merged 1 commit into from
Jun 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/models/mongoose_models/MetadataCardSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,16 @@ export interface IStreak {
timeStamp: number;
}

export type IStreakMap = IStreak & Map<string, any>;
export type IStreakMap = IStreak & Map<string, Array<string> | number>;

interface IMetadataNodeInformationEntry {
[id: string]: { urgency: number };
}

interface IMetadataNodeStatsEntry {
[id: string]: { urgency?: number };
}

export interface IMetadataNodeInformation {
[tag: string]: IMetadataNodeInformationEntry;
}
Expand All @@ -31,7 +35,7 @@ export interface IMetadata {
metadataIndex: number;
node_information: Array<IMetadataNodeInformation>;
trashed_cards: Array<IMetadataTrashedCardInformation>;
stats: Array<any>;
stats: Array<IMetadataNodeStatsEntry>;
streak: IStreak;
cardsAreByDefaultPrivate: boolean;
}
Expand Down
15 changes: 11 additions & 4 deletions src/public/src/components/card-viewer/base-card-viewer.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
import { consume } from "@lit/context";
import { css, html, LitElement, nothing, TemplateResult } from "lit";
import {
css,
html,
LitElement,
nothing,
PropertyValues,
TemplateResult,
} from "lit";
import { property } from "lit/decorators.js";
import { createRef, Ref, ref } from "lit/directives/ref.js";
import { unsafeHTML } from "lit/directives/unsafe-html.js";
Expand Down Expand Up @@ -28,7 +35,7 @@ export interface CardDescription {

export class CardViewer extends LitElement {
@property({ type: Object })
protected card: Card | null = null;
public card: Card | null = null;

@consume({ context: cardsCarouselContext, subscribe: true })
protected cardsCarousel?: CardsCarousel;
Expand All @@ -49,13 +56,13 @@ export class CardViewer extends LitElement {
return new Set(this.card.tags.split(" ").filter(Boolean));
}

protected willUpdate(changedProperties: Map<string, any>) {
protected willUpdate(changedProperties: PropertyValues<this>) {
if (changedProperties.has("card")) {
this.updatePromptAndResponse();
}
}

updated(changedProperties: Map<string, any>) {
updated(changedProperties: PropertyValues<this>) {
if (changedProperties.has("card")) {
if (this.card) {
this.cardDialogRef.value?.showModal();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { css, html, LitElement } from "lit";
import { css, html, LitElement, PropertyValues } from "lit";
import { customElement, property, state } from "lit/decorators.js";
import { createRef, Ref, ref } from "lit/directives/ref.js";

Expand All @@ -20,7 +20,7 @@ export class EditableCardDescriptionElement extends LitElement {

private descriptionRef: Ref<HTMLDivElement> = createRef();

protected willUpdate(changedProperties: Map<string, any>) {
protected willUpdate(changedProperties: PropertyValues<this>) {
if (changedProperties.has("value") || changedProperties.has("canEdit")) {
this.showOverlay = !this.canEdit && this.value
&& this.value.type === CardDescriptionType.Response;
Expand Down
6 changes: 3 additions & 3 deletions src/public/src/components/card-viewer/editable-card-viewer.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { css, html, nothing } from "lit";
import { css, html, nothing, PropertyValues } from "lit";
import { customElement, property, state } from "lit/decorators.js";

import { CardsCarouselUpdateCursorDirection } from "../../context/cards-carousel-context.js";
Expand Down Expand Up @@ -29,14 +29,14 @@ export class EditableCardViewer extends CardViewer {
}

@property({ type: Object })
protected card: PrivateCardResult = null;
public card: PrivateCardResult = null;

@state()
protected canEdit = false;

private pendingChanges: PendingChanges = {};

protected willUpdate(changedProperties: Map<string, any>) {
protected willUpdate(changedProperties: PropertyValues<this>) {
if (changedProperties.has("card")) {
this.canEdit = false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ enum FlagReason {
@customElement("public-card-viewer")
export class PublicCardViewer extends CardViewer {
@property({ type: Object })
protected card: PublicCardResult = null;
public card: PublicCardResult = null;

private flagCard(reason: FlagReason) {
if (!this.card) {
Expand Down
2 changes: 1 addition & 1 deletion src/public/src/models/core/ternary-search-trie.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ interface TSTNode {
left: TSTNode | null;
mid: TSTNode | null;
right: TSTNode | null;
val: any;
val: boolean | null;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ if (config.IS_TS_NODE) {
app.use(express.static(newStaticsPath));
}

app.use(function(err: any, req: Request, res: Response) {
app.use(function(err: Error, req: Request, res: Response) {
console.error(err.stack);
res.status(500).render(
"pages/5xx_error_page.ejs",
Expand Down
Loading