chore: More typescript FIXME's removed
This commit is contained in:
@@ -98,10 +98,7 @@ describe("#parseDomain", () => {
|
||||
});
|
||||
|
||||
it("should return null if the given value is not a string", () => {
|
||||
// @ts-expect-error ts-migrate(2345) FIXME: Argument of type 'undefined' is not assignable to ... Remove this comment to see the full error message
|
||||
expect(parseDomain(undefined)).toBe(null);
|
||||
// @ts-expect-error ts-migrate(2345) FIXME: Argument of type '{}' is not assignable to paramet... Remove this comment to see the full error message
|
||||
expect(parseDomain({})).toBe(null);
|
||||
expect(parseDomain("")).toBe(null);
|
||||
});
|
||||
|
||||
|
||||
@@ -9,9 +9,10 @@ type Domain = {
|
||||
// we originally used the parse-domain npm module however this includes
|
||||
// a large list of possible TLD's which increase the size of the bundle
|
||||
// unnecessarily for our usecase of trusted input.
|
||||
export function parseDomain(url: string): Domain | null | undefined {
|
||||
export function parseDomain(url?: string): Domain | null | undefined {
|
||||
if (typeof url !== "string") return null;
|
||||
if (url === "") return null;
|
||||
|
||||
// strip extermeties and whitespace from input
|
||||
const normalizedDomain = trim(url.replace(/(https?:)?\/\//, ""));
|
||||
const parts = normalizedDomain.split(".");
|
||||
|
||||
@@ -38,7 +38,6 @@ describe("#naturalSort", () => {
|
||||
name: "Mark",
|
||||
},
|
||||
];
|
||||
// @ts-expect-error ts-migrate(2345) FIXME: Argument of type '(item: any) => any' is not assig... Remove this comment to see the full error message
|
||||
expect(naturalSort(items, (item) => item.name)).toEqual([
|
||||
{
|
||||
name: "Joan",
|
||||
|
||||
@@ -27,7 +27,7 @@ function getSortByField<T>(
|
||||
|
||||
function naturalSortBy<T>(
|
||||
items: T[],
|
||||
key: string | (() => string),
|
||||
key: string | ((item: T) => string),
|
||||
sortOptions?: NaturalSortOptions
|
||||
): T[] {
|
||||
if (!items) return [];
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import path from "path";
|
||||
// @ts-expect-error ts-migrate(2724) FIXME: '"jszip"' has no exported member named 'ZipObject'... Remove this comment to see the full error message
|
||||
import JSZip, { ZipObject } from "jszip";
|
||||
import JSZip, { JSZipObject } from "jszip";
|
||||
|
||||
type ItemType = "collection" | "document" | "attachment";
|
||||
|
||||
export type Item = {
|
||||
path: string;
|
||||
@@ -8,9 +9,8 @@ export type Item = {
|
||||
name: string;
|
||||
depth: number;
|
||||
metadata: Record<string, any>;
|
||||
type: "collection" | "document" | "attachment";
|
||||
|
||||
item: ZipObject;
|
||||
type: ItemType;
|
||||
item: JSZipObject;
|
||||
};
|
||||
|
||||
export async function parseOutlineExport(
|
||||
@@ -47,7 +47,7 @@ export async function parseOutlineExport(
|
||||
);
|
||||
}
|
||||
|
||||
let type;
|
||||
let type: ItemType | undefined;
|
||||
|
||||
if (depth === 0 && item.dir && name) {
|
||||
type = "collection";
|
||||
@@ -70,7 +70,6 @@ export async function parseOutlineExport(
|
||||
dir,
|
||||
name,
|
||||
depth,
|
||||
// @ts-expect-error ts-migrate(2322) FIXME: Type 'string' is not assignable to type '"collecti... Remove this comment to see the full error message
|
||||
type,
|
||||
metadata,
|
||||
item,
|
||||
|
||||
Reference in New Issue
Block a user