Skip to content

Commit ff82e36

Browse files
committed
feat: add typescript support
1 parent ce75f1f commit ff82e36

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

util/leetcode.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { extract_rust_solution, underline } from './utils'
22
import { Problem, sequelize } from './crawl_leetcode'
3-
import { generatePool, JSconfig } from './pools_utils'
3+
import { generatePool, TSconfig } from './pools_utils'
44

55
test('test underline filename', () => {
66
const a = underline('minimum-swaps-to-group-all-1s-together')
@@ -41,12 +41,12 @@ test('leetcode statistics', async () => {
4141
test('generate special', async () => {
4242
const r = await Problem.findAll({
4343
where: {
44-
frontend_id: 141,
44+
frontend_id: 1379,
4545
},
4646
})
4747

4848
await generatePool({
4949
problems: r,
50-
config: JSconfig,
50+
config: TSconfig,
5151
})
5252
})

util/pools_utils.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,14 @@ interface CodeConfig {
2525

2626
export const JSconfig: CodeConfig = {
2727
getCode: (c) => c.find((a) => a.value === 'javascript').defaultCode,
28-
ext: 'js',
28+
ext: 'test.js',
29+
comment: '//',
30+
fileNameStyle: (s, i) => `_${i.toString().padStart(4, '0')}_${underline(s)}`,
31+
}
32+
33+
export const TSconfig: CodeConfig = {
34+
getCode: (c) => c.find((a) => a.value === 'typescript').defaultCode,
35+
ext: 'test.ts',
2936
comment: '//',
3037
fileNameStyle: (s, i) => `_${i.toString().padStart(4, '0')}_${underline(s)}`,
3138
}

0 commit comments

Comments
 (0)