Skip to content

Commit eb9503a

Browse files
committed
remove return type annotations
1 parent 3f29a0e commit eb9503a

25 files changed

+182
-233
lines changed

build/dev.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ const BUILD_OPTIONS: BuildOptions = {
1212
minify: false,
1313
define: { LIVE_RELOAD: "true" },
1414
};
15-
async function watchMain(): Promise<AsyncDisposable> {
15+
async function watchMain() {
1616
await using stack = new AsyncDisposableStack();
1717
const buildContext = stack.use({
1818
context: await context(BUILD_OPTIONS),
19-
async [Symbol.asyncDispose](): Promise<void> {
19+
async [Symbol.asyncDispose]() {
2020
await this.context.dispose();
2121
},
2222
});
@@ -25,7 +25,7 @@ async function watchMain(): Promise<AsyncDisposable> {
2525
stack.move();
2626
return buildContext;
2727
}
28-
async function watchDictionary(): Promise<number> {
28+
async function watchDictionary() {
2929
const command = new Deno.Command(Deno.execPath(), {
3030
args: [
3131
"run",

deno.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
"tags": ["recommended"],
4646
"include": [
4747
"camelcase",
48-
"explicit-function-return-type",
4948
"explicit-module-boundary-types",
5049
"no-console",
5150
"no-boolean-literal-for-arguments",

dictionary/build.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,7 @@ export async function build(): Promise<boolean> {
5050
);
5151
return true;
5252
}
53-
function displayError(
54-
source: string,
55-
errors: ReadonlyArray<ArrayResultError>,
56-
): void {
53+
function displayError(source: string, errors: ReadonlyArray<ArrayResultError>) {
5754
let color: boolean;
5855
try {
5956
color = Deno.env.get("NO_COLOR") !== "1";

dictionary/parser.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ const ignore = allWithCheck(
5151
choiceWithCheck(spaces, comment),
5252
),
5353
);
54-
function lex<T>(parser: Parser<T>): Parser<T> {
54+
function lex<T>(parser: Parser<T>) {
5555
return parser.skip(ignore);
5656
}
5757
const wordWithPosition = lex(
@@ -100,10 +100,10 @@ const perspective = choiceOnlyOne(
100100
keyword("second"),
101101
keyword("third"),
102102
);
103-
function tag<T>(parser: Parser<T>): Parser<T> {
103+
function tag<T>(parser: Parser<T>) {
104104
return openParenthesis.with(parser).skip(closeParenthesis);
105105
}
106-
function template<T>(parser: Parser<T>): Parser<T> {
106+
function template<T>(parser: Parser<T>) {
107107
return openBracket.with(parser).skip(closeBracket);
108108
}
109109
const simpleUnit = memoize((kind: string) => word.skip(tag(keyword(kind))));
@@ -260,22 +260,19 @@ const checkedNoun = new CheckedParser(
260260
),
261261
noun,
262262
);
263-
function checkedSimpleUnitWith<T>(
264-
tag: string,
265-
after: Parser<T>,
266-
): CheckedParser<readonly [string, T]> {
263+
function checkedSimpleUnitWith<T>(tag: string, after: Parser<T>) {
267264
return checkedSequence(
268265
word.skip(openParenthesis).skip(keyword(tag)),
269266
closeParenthesis.with(after),
270267
);
271268
}
272-
function checkedSimpleUnit(tag: string): CheckedParser<string> {
269+
function checkedSimpleUnit(tag: string) {
273270
return checkedSimpleUnitWith(tag, nothing).map(([word]) => word);
274271
}
275272
function checkedSimpleUnitWithTemplate(
276273
tag: string,
277274
templateInside: Parser<unknown>,
278-
): CheckedParser<string> {
275+
) {
279276
return checkedSimpleUnitWith(tag, template(templateInside))
280277
.map(([word]) => word);
281278
}

src/dictionary.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export function loadCustomDictionary(dictionary: Dictionary): void {
2323
}
2424
update();
2525
}
26-
function update(): void {
26+
function update() {
2727
dictionary.clear();
2828
const words = new Set([
2929
...globalDictionary.keys(),
@@ -54,17 +54,14 @@ function update(): void {
5454
function redefineSet(
5555
set: Set<string>,
5656
filter: (definition: Definition) => boolean,
57-
): void {
57+
) {
5858
set.clear();
5959
for (const [word, { definitions }] of dictionary) {
6060
if (definitions.some(filter)) {
6161
set.add(word);
6262
}
6363
}
6464
}
65-
function redefineSetWithType(
66-
set: Set<string>,
67-
type: Definition["type"],
68-
): void {
65+
function redefineSetWithType(set: Set<string>, type: Definition["type"]) {
6966
redefineSet(set, ({ type: compareType }) => compareType === type);
7067
}

src/main.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ const WORD_NOT_FOUND_MESSAGE = "Word not found";
6262
const WORD_ALREADY_IMPORTED_MESSAGE = "The word is already imported";
6363
const DICTIONARY_ERROR_MESSAGE = "Please fix the errors before saving";
6464

65-
function main(): void {
65+
function main() {
6666
// load elements
6767
const inputTextBox = document.getElementById(
6868
"input",
@@ -144,13 +144,13 @@ function main(): void {
144144
) as HTMLAnchorElement;
145145

146146
// determines whether the dictionary can be automatically parsed
147-
function autoParse(): boolean {
147+
function autoParse() {
148148
return customDictionaryTextBox.value.length <=
149149
DICTIONARY_AUTO_PARSE_THRESHOLD;
150150
}
151151

152152
// emulates `window.alert`
153-
function showMessage(useMessage: string): void {
153+
function showMessage(useMessage: string) {
154154
message.innerText = useMessage;
155155
alertBox.showModal();
156156
}
@@ -193,21 +193,21 @@ function main(): void {
193193

194194
// initial text area size
195195
resizeTextarea();
196-
function resizeTextarea(): void {
196+
function resizeTextarea() {
197197
inputTextBox.style.height = "auto";
198198
inputTextBox.style.height = `${inputTextBox.scrollHeight + 14}px`;
199199
}
200200

201201
// initialize button label
202202
updateLabel();
203-
function updateLabel(): void {
203+
function updateLabel() {
204204
translateButton.innerText = settings.multiline
205205
? TRANSLATE_LABEL_MULTILINE
206206
: TRANSLATE_LABEL;
207207
}
208208

209209
// show custom dictionary errors
210-
function showDictionaryError(): void {
210+
function showDictionaryError() {
211211
customDictionaryErrorSummary.innerText =
212212
`Errors (${currentDictionary.errors.length}):`;
213213
customDictionaryErrorList.innerHTML = "";
@@ -239,7 +239,7 @@ function main(): void {
239239
updateOutput();
240240
}
241241
});
242-
function updateOutput(): void {
242+
function updateOutput() {
243243
outputList.innerHTML = "";
244244
errorList.innerHTML = "";
245245
errorDisplay.innerText = "";
@@ -300,7 +300,7 @@ function main(): void {
300300
importWord();
301301
}
302302
});
303-
function importWord(): void {
303+
function importWord() {
304304
const word = importWordTextBox.value.trim();
305305
if (word === "") {
306306
showMessage(NO_WORD_MESSAGE);
@@ -338,16 +338,16 @@ function main(): void {
338338
}
339339
tryCloseDictionary();
340340
});
341-
function updateDictionary(): void {
341+
function updateDictionary() {
342342
currentDictionary = dictionaryParser.parse(customDictionaryTextBox.value);
343343
showDictionaryError();
344344
}
345-
function updateIfCanAutoParse(): void {
345+
function updateIfCanAutoParse() {
346346
if (autoParse()) {
347347
updateDictionary();
348348
}
349349
}
350-
function tryCloseDictionary(): void {
350+
function tryCloseDictionary() {
351351
if (!currentDictionary.isError()) {
352352
lastSavedText = customDictionaryTextBox.value;
353353
lastSavedDictionary = currentDictionary;

src/parser/composer.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export function filler(filler: Filler): string {
3232
return emphasis(filler);
3333
}
3434
}
35-
function emphasisAsArray(value: null | Emphasis): ReadonlyArray<string> {
35+
function emphasisAsArray(value: null | Emphasis) {
3636
return nullableAsArray(value).map(emphasis);
3737
}
3838
export function simpleWordUnit(wordUnit: SimpleWordUnit): string {
@@ -90,10 +90,7 @@ export function phrase(value: Phrase): string {
9090
return preposition(value);
9191
}
9292
}
93-
function particle(
94-
type: "and conjunction" | "anu",
95-
particle: null | string,
96-
): string {
93+
function particle(type: "and conjunction" | "anu", particle: null | string) {
9794
if (type === "and conjunction") {
9895
return particle!;
9996
} else {

src/parser/filter.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -392,10 +392,10 @@ export function filter<T>(
392392
}
393393
};
394394
}
395-
function modifierIsNumeric(modifier: Modifier): boolean {
395+
function modifierIsNumeric(modifier: Modifier) {
396396
return modifier.type === "default" && modifier.word.type === "number";
397397
}
398-
function modifiersIsAlaOrNone(modifiers: ReadonlyArray<Modifier>): boolean {
398+
function modifiersIsAlaOrNone(modifiers: ReadonlyArray<Modifier>) {
399399
switch (modifiers.length) {
400400
case 0:
401401
return true;
@@ -408,7 +408,7 @@ function modifiersIsAlaOrNone(modifiers: ReadonlyArray<Modifier>): boolean {
408408
return false;
409409
}
410410
}
411-
function hasPrepositionInPhrase(phrase: Phrase): boolean {
411+
function hasPrepositionInPhrase(phrase: Phrase) {
412412
switch (phrase.type) {
413413
case "default":
414414
return false;
@@ -418,15 +418,15 @@ function hasPrepositionInPhrase(phrase: Phrase): boolean {
418418
return hasPrepositionInPhrase(phrase.phrase);
419419
}
420420
}
421-
function phraseHasTopLevelEmphasis(phrase: Phrase): boolean {
421+
function phraseHasTopLevelEmphasis(phrase: Phrase) {
422422
switch (phrase.type) {
423423
case "default":
424424
case "preverb":
425425
case "preposition":
426426
return phrase.emphasis != null;
427427
}
428428
}
429-
function getDuplicate<T>(iterable: Iterable<T>): Set<T> {
429+
function getDuplicate<T>(iterable: Iterable<T>) {
430430
const unique = new Set<T>();
431431
const duplicates = new Set<T>();
432432
for (const value of iterable) {

0 commit comments

Comments
 (0)