Skip to content

Commit 7e90365

Browse files
committed
Fix type checking issues
1 parent d75473b commit 7e90365

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/tools/text-to-unicode/text-to-unicode.service.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ describe('text-to-unicode', () => {
4343
interface TestConfig {
4444
text: string
4545
results: Record<ConverterId, string>
46-
skipPrintableAscii?: boolean
46+
skipAscii?: boolean
4747
};
4848
const tests: TestConfig[] = [
4949
{
@@ -57,7 +57,7 @@ describe('text-to-unicode', () => {
5757
},
5858
{
5959
text: 'ABC',
60-
skipPrintableAscii: true,
60+
skipAscii: true,
6161
results: {
6262
fullUnicode: 'ABC',
6363
utf16: 'ABC',
@@ -67,7 +67,7 @@ describe('text-to-unicode', () => {
6767
},
6868
{
6969
text: ALL_PRINTABLE_ASCII,
70-
skipPrintableAscii: true,
70+
skipAscii: true,
7171
results: {
7272
// eslint-disable-next-line unicorn/escape-case
7373
fullUnicode: String.raw` !\u0022#$%&\u0027()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\u005c]^_${'`'}abcdefghijklmnopqrstuvwxyz{|}~`,
@@ -90,7 +90,7 @@ describe('text-to-unicode', () => {
9090
},
9191
{
9292
text: 'a 💩 b',
93-
skipPrintableAscii: true,
93+
skipAscii: true,
9494
results: {
9595
// eslint-disable-next-line unicorn/escape-case
9696
fullUnicode: String.raw`a \u{1f4a9} b`,
@@ -102,13 +102,13 @@ describe('text-to-unicode', () => {
102102
},
103103
];
104104

105-
for (const { text, skipPrintableAscii: skipAscii, results } of tests) {
105+
for (const { text, skipAscii, results } of tests) {
106106
describe(`${text} (skipAscii=${skipAscii})`, () => {
107107
for (const [key, result] of Object.entries(results)) {
108108
describe(key, () => {
109109
const converter = converters[key as ConverterId];
110110
it('Escaping', () => {
111-
expect(converter.escape(text, skipAscii)).toBe(result);
111+
expect(converter.escape(text, skipAscii ?? false)).toBe(result);
112112
});
113113
it('Unescaping', () => {
114114
expect(converter.unescape(result)).toBe(text);

src/tools/text-to-unicode/text-to-unicode.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ export const SKIP_ASCII_JS = /([ -!#-&(-\[\]-~]+)/g;
44
export const SKIP_ASCII_HTML = /([ -!#-%(-;=?-~]+)/g;
55

66
function codeUnits(text: string): number[] {
7-
return text.split('').map(char => char.codePointAt(0));
7+
return text.split('').map(char => char.codePointAt(0)!);
88
}
99

1010
function codePoints(text: string): number[] {
11-
return [...text].map(char => char.codePointAt(0));
11+
return [...text].map(char => char.codePointAt(0)!);
1212
}
1313

1414
interface ConverterConfig {

src/tools/text-to-unicode/text-to-unicode.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const { copy: copyText } = useCopy({ source: textFromUnicode });
2727
v-model:value="converterId"
2828
searchable
2929
label="Conversion type:"
30-
:options="Object.entries(converters).map(([key, val]) => ({ label: val.name, value: key }))"
30+
:options="Object.entries(converters).map(([key, val]) => ({ label: val.config.name, value: key }))"
3131
/>
3232
</div>
3333
<c-card class="card" title="Text to Unicode">

0 commit comments

Comments
 (0)