Skip to content

Commit 0f515fa

Browse files
committed
typescript config fix
1 parent 5fc4269 commit 0f515fa

8 files changed

Lines changed: 700 additions & 139 deletions

File tree

package-lock.json

Lines changed: 680 additions & 119 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/LatexMathPlugin.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const DEFAULT_SETTINGS: LatexMathPluginSettings = {
2727
};
2828

2929
export default class LatexMathPlugin extends Plugin {
30-
settings: LatexMathPluginSettings;
30+
settings!: LatexMathPluginSettings;
3131

3232
async onload() {
3333
console.log(`Loading LaTeX Math (v${this.manifest.version})`);
@@ -109,12 +109,11 @@ export default class LatexMathPlugin extends Plugin {
109109
private static readonly STATUS_BAR_UPDATE_FREQ: UnixTimestampMillis = 500;
110110
private static readonly STATUS_BAR_MESSAGE_HANG_TIME: UnixTimestampMillis = 1000;
111111

112-
private cas_server: CasServer;
113-
private spawn_cas_client_promise: Promise<void>;
112+
private cas_server!: CasServer;
113+
private spawn_cas_client_promise!: Promise<void>;
114114
private prev_err_notice: Notice | null = null;
115115

116116
private async setupCasConnection() {
117-
this.cas_server = new CasServer();
118117
this.cas_server.onError(this.handleCasError.bind(this));
119118

120119
this.spawn_cas_client_promise = this.spawnCasClient(this.manifest.dir as string);
@@ -169,7 +168,7 @@ export default class LatexMathPlugin extends Plugin {
169168
await this.cas_server.initializeAsync(cas_client_spawner);
170169
}
171170

172-
private onCommandFailed(failed_command: LatexMathCommand, unexpected_response: ClientResponse, expected_statuses: Set<string>) {
171+
private onCommandFailed(failed_command: unknown, unexpected_response: ClientResponse, expected_statuses: Set<string>) {
173172
console.error("Command Failed!\nCommand:\t\t\t",
174173
failed_command,
175174
"\nExpected value types:\t",

src/controllers/commands/LatexMathCommand.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { CasServer } from "/services/CasServer";
77
// function callback is called whenever the command has been invoked by the user.
88
// use the response_verifire dependency to verify responses sent to the CasServer.
99
export abstract class LatexMathCommand {
10-
readonly id: string; // TODO: this should not be here, it should be in a separate controller
10+
readonly id!: string; // TODO: this should not be here, it should be in a separate controller
1111
// in general, these command classes should be more split up.
1212

1313
constructor(public response_verifier: SuccessResponseVerifier) { }

src/services/CasServer.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ export interface SendResult {
9999

100100
interface MessagePromiseEntry {
101101
sent_time: UnixTimestampMillis;
102-
resolve: (value: ClientResponse | PromiseLike<ClientResponse>) => void;
102+
resolve: (value: SuccessResponse | PromiseLike<SuccessResponse>) => void;
103103
reject: (reason?: unknown) => void;
104104
}
105105

@@ -221,10 +221,10 @@ export class CasServer {
221221
}
222222

223223

224-
private client_process: ChildProcessWithoutNullStreams;
225-
private ws_cas_client: WebSocket;
226-
private ws_cas_server: WebSocketServer;
227-
private error_callback: (usr_error: string, dev_error: string) => void;
224+
private client_process!: ChildProcessWithoutNullStreams;
225+
private ws_cas_client!: WebSocket;
226+
private ws_cas_server!: WebSocketServer;
227+
private error_callback!: (usr_error: string, dev_error: string) => void;
228228

229229
private message_promises: Record<string, MessagePromiseEntry> = {};
230230

@@ -270,7 +270,7 @@ export class CasServer {
270270
break;
271271
}
272272
case MessageStatus.SUCCESS: {
273-
message_promise?.resolve(response);
273+
message_promise?.resolve(response as SuccessResponse);
274274
break;
275275
}
276276
default: {

src/utils/LatexFormatter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as prettierPluginLatex from "prettier-plugin-latex";
33

44
// Indent and format the given string of latex source code, for prettier printing.
55
export async function formatLatex(latex_string: string): Promise<string> {
6-
return await Prettier.format(latex_string, {
6+
return Prettier.format(latex_string, {
77
printWidth: 80,
88
useTabs: false,
99
parser: "latex-parser",

src/views/LmatSettingsTab.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import LatexMathPlugin from 'LatexMathPlugin';
1+
import LatexMathPlugin from '/LatexMathPlugin';
22
import { App, PluginSettingTab, Setting} from 'obsidian';
33

44
// Settings tab for Latex Math plugin.

src/views/modals/BaseModal.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ export class BaseModal extends Modal {
1010
this.default_action();
1111
});
1212
}
13-
protected default_action: () => void;
13+
protected default_action: () => void = () => { };
1414
}

tsconfig.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
{
22
"compilerOptions": {
3-
"baseUrl": "./src",
43
"paths": {
54
"/*": [
6-
"./*"
5+
"./src/*"
76
]
87
},
98
"inlineSourceMap": true,
109
"inlineSources": true,
11-
"module": "ESNext",
10+
"module": "esnext",
1211
"target": "ES2022",
1312
"allowJs": true,
1413
"noImplicitAny": true,
15-
"moduleResolution": "node",
14+
"moduleResolution": "bundler",
15+
"resolvePackageJsonExports": false,
16+
"skipLibCheck": true,
1617
"importHelpers": true,
1718
"isolatedModules": true,
1819
"strictNullChecks": true,
@@ -28,4 +29,4 @@
2829
"include": [
2930
"**/*.ts"
3031
]
31-
}
32+
}

0 commit comments

Comments
 (0)