Skip to content

Commit 11cc0d0

Browse files
committed
Type updates
1 parent 89bc5db commit 11cc0d0

4 files changed

Lines changed: 12 additions & 23 deletions

File tree

scripts/deploy.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import { ethers } from "hardhat";
22

33
import { deployAll } from "./contracts";
4+
import { initializeUnicodeData } from "./initialization";
45

56
async function main() {
67
console.log("starting deployment...");
7-
await deployAll();
8+
const [unicodeData] = await deployAll();
89
console.log("deployment complete.");
10+
await initializeUnicodeData(unicodeData);
911
}
1012

1113
// We recommend this pattern to be able to use async/await everywhere

scripts/parsers/unicode.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ const parseUnicodeData = (data: string): Character[] =>
7171
] = line.split(";");
7272

7373
// initialize the character with required fields
74-
const character: Character = {
74+
const character: Partial<Character> = {
7575
// code is hexadecimal
7676
code: parseInt(code, HEXADECIMAL),
7777
// name is a string
@@ -117,7 +117,7 @@ const parseUnicodeData = (data: string): Character[] =>
117117
? parseInt(titlecase, HEXADECIMAL)
118118
: character.uppercase;
119119

120-
return character;
120+
return character as Character;
121121
});
122122

123123
export default parseUnicodeData;

scripts/types.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,18 @@ export interface Character {
3030
Otherwise, if field 8 is non-empty, then Numeric_Type=Numeric.
3131
For characters listed in the Unihan data files, Numeric_Type=Numeric for characters that have kPrimaryNumeric, kAccountingNumeric, or kOtherNumeric tags. The default value is Numeric_Type=None.
3232
*/
33-
decimal?: number;
34-
digit?: number;
33+
decimal: number;
34+
digit: number;
3535
/** numeric value of character (may be a fraction, so it not unevaluated) */
36-
numeric?: Numeric;
36+
numeric: Numeric;
3737
/** true if character is mirrored in bidirectional text (missing otherwise) */
38-
mirrored?: boolean;
38+
mirrored: boolean;
3939
/** simple uppercase mapping */
40-
uppercase?: number;
40+
uppercase: number;
4141
/** simple lowercase mapping */
42-
lowercase?: number;
42+
lowercase: number;
4343
/** simple titlecase mapping */
44-
titlecase?: number;
44+
titlecase: number;
4545
}
4646

4747
export type JamoShortNames = Record<string, string>;

scripts/unicode-data.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -98,16 +98,3 @@ export const getUnicodeData = async (): Promise<Character[]> => {
9898

9999
return characters;
100100
};
101-
102-
async function main() {
103-
await getUnicodeData();
104-
}
105-
106-
// We recommend this pattern to be able to use async/await everywhere
107-
// and properly handle errors.
108-
main()
109-
.then(() => process.exit(0))
110-
.catch((error) => {
111-
console.error(error);
112-
process.exit(1);
113-
});

0 commit comments

Comments
 (0)