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

Bump typescript from 4.0.5 to 4.3.2 #415

Merged
merged 4 commits into from
Jun 3, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
"howler": "^2.2.1",
"html-loader": "^1.3.2",
"htmlmetaparser": "^2.1.1",
"idb": "^5.0.8",
"idb": "^6.1.2",
twschiller marked this conversation as resolved.
Show resolved Hide resolved
"immer": "^8.0.1",
"install": "^0.13.0",
"is-promise": "^4.0.0",
Expand Down Expand Up @@ -192,7 +192,7 @@
"to-json-schema": "^0.2.5",
"ts-loader": "^8.1.0",
"type-fest": "^1.0.1",
"typescript": "^4.0.5",
"typescript": "^4.3.2",
"url-join": "^4.0.1",
"use-async-effect": "^2.2.3",
"use-debounce": "^5.2.0",
Expand Down
24 changes: 10 additions & 14 deletions src/background/executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,32 +240,28 @@ function backgroundListener(
});
}
case MESSAGE_ACTIVATE_TAB: {
return new Promise((resolve) => {
return (
browser.tabs
twschiller marked this conversation as resolved.
Show resolved Hide resolved
.update(sender.tab.id, {
active: true,
})
// ignore the returned tab
.then(() => resolve());
});
.then(() => {})
);
}
case MESSAGE_CLOSE_TAB: {
return new Promise<unknown>((resolve) => {
browser.tabs.remove(sender.tab.id).then(resolve);
});
}
case MESSAGE_OPEN_TAB: {
return new Promise<unknown>((resolve, reject) => {
browser.tabs
.create(request.payload as Tabs.CreateCreatePropertiesType)
.then((tab) => {
// FIXME: include frame information here
tabToTarget.set(sender.tab.id, tab.id);
tabToOpener.set(tab.id, sender.tab.id);
resolve();
})
.catch(reject);
});
return browser.tabs
.create(request.payload as Tabs.CreateCreatePropertiesType)
.then((tab) => {
// FIXME: include frame information here
tabToTarget.set(sender.tab.id, tab.id);
tabToOpener.set(tab.id, sender.tab.id);
});
}
case MESSAGE_CONTENT_SCRIPT_READY: {
const tabId = sender.tab.id;
Expand Down
11 changes: 6 additions & 5 deletions src/contrib/google/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,14 @@ export async function resetToken(scopes: string[]): Promise<void> {
if (token) {
console.debug(`Clearing Google token: ${token}`);

await new Promise((resolve, reject) => {
await new Promise<void>((resolve, reject) => {
chrome.identity.removeCachedAuthToken({ token }, () => {
resolve();
if (chrome.runtime.lastError) {
reject(new Error(chrome.runtime.lastError.message));
} else {
resolve();
}
});
if (chrome.runtime.lastError) {
reject(new Error(chrome.runtime.lastError.message));
}
twschiller marked this conversation as resolved.
Show resolved Hide resolved
});
}

Expand Down
2 changes: 1 addition & 1 deletion src/contrib/google/sheets/FileField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ const FileField: React.FunctionComponent<

console.debug(`Using Google token: ${token}`);

await new Promise((resolve) => {
await new Promise<void>((resolve) => {
gapi.load("picker", {
callback: () => resolve(),
});
Expand Down
4 changes: 2 additions & 2 deletions src/extensionPoints/contextMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ function guessSelectedElement(): HTMLElement | null {
const end = selection.getRangeAt(selection.rangeCount - 1).endContainer
.parentNode;
const node = getCommonAncestor(start, end);
if ("tagName" in node) {
if (node instanceof HTMLElement) {
return node;
} else {
return null;
Expand Down Expand Up @@ -176,7 +176,7 @@ export abstract class ContextMenuExtensionPoint extends ExtensionPoint<ContextMe
super(id, name, description, icon);
}
public readonly syncInstall: boolean = true;
abstract async getBaseReader(): Promise<IReader>;
abstract getBaseReader(): Promise<IReader>;
twschiller marked this conversation as resolved.
Show resolved Hide resolved
abstract readonly documentUrlPatterns: Manifest.MatchPattern[];
abstract readonly contexts: ContextMenus.ContextType[];

Expand Down
25 changes: 11 additions & 14 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,19 +154,19 @@ export abstract class ExtensionPoint<TConfig extends BaseExtensionConfig>
}
}

abstract async defaultReader(): Promise<IReader>;
abstract defaultReader(): Promise<IReader>;

abstract async getBlocks(extension: IExtension<TConfig>): Promise<IBlock[]>;
abstract getBlocks(extension: IExtension<TConfig>): Promise<IBlock[]>;

abstract async isAvailable(): Promise<boolean>;
abstract isAvailable(): Promise<boolean>;

abstract async install(): Promise<boolean>;
abstract install(): Promise<boolean>;

uninstall(options?: { global?: boolean }): void {
console.warn(`Uninstall not implemented for extension point: ${this.id}`);
}

abstract async run(): Promise<void>;
abstract run(): Promise<void>;
}

export abstract class Block implements IBlock {
Expand All @@ -193,7 +193,7 @@ export abstract class Block implements IBlock {
this.icon = icon;
}

abstract async run(value: BlockArg, options: BlockOptions): Promise<unknown>;
abstract run(value: BlockArg, options: BlockOptions): Promise<unknown>;
}

export abstract class Effect extends Block {
Expand All @@ -206,7 +206,7 @@ export abstract class Effect extends Block {
super(id, name, description, icon);
}

abstract async effect(inputs: BlockArg, env?: BlockOptions): Promise<void>;
abstract effect(inputs: BlockArg, env?: BlockOptions): Promise<void>;

async run(value: BlockArg, options: BlockOptions): Promise<void> {
return this.effect(value, options);
Expand All @@ -223,10 +223,7 @@ export abstract class Transformer extends Block {
super(id, name, description, icon);
}

abstract async transform(
value: BlockArg,
options: BlockOptions
): Promise<unknown>;
abstract transform(value: BlockArg, options: BlockOptions): Promise<unknown>;

async run(value: BlockArg, options: BlockOptions): Promise<unknown> {
return this.transform(value, options);
Expand All @@ -243,7 +240,7 @@ export abstract class Renderer extends Block {
super(id, name, description, icon);
}

abstract async render(
abstract render(
inputs: BlockArg,
options: BlockOptions
): Promise<RenderedHTML>;
Expand All @@ -267,9 +264,9 @@ export abstract class Reader extends Block implements IReader {
super(id, name, description, icon);
}

abstract async isAvailable($elt?: JQuery): Promise<boolean>;
abstract isAvailable($elt?: JQuery): Promise<boolean>;

abstract async read(root: HTMLElement | Document): Promise<ReaderOutput>;
abstract read(root: HTMLElement | Document): Promise<ReaderOutput>;

async run({ root }: { root: HTMLElement | Document }): Promise<ReaderOutput> {
return this.read(root);
Expand Down