Skip to content

Commit 2912183

Browse files
cmdcolinclaude
andcommitted
update typescript to latest
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 733a7a2 commit 2912183

File tree

9 files changed

+1299
-1194
lines changed

9 files changed

+1299
-1194
lines changed

CHANGELOG.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# [7.0.0](https://github.com/GMOD/vcf-js/compare/v6.1.2...v7.0.0) (2026-01-18)
22

3-
4-
53
## [6.1.2](https://github.com/GMOD/vcf-js/compare/v6.1.1...v6.1.2) (2026-01-18)
64

75
# [6.1.0](https://github.com/GMOD/vcf-js/compare/v6.0.9...v6.1.0) (2025-11-26)

eslint.config.mjs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,14 @@ export default defineConfig(
5757
},
5858
],
5959

60-
'@typescript-eslint/ban-ts-comment': 'off',
60+
'@typescript-eslint/ban-ts-comment': [
61+
'error',
62+
{ 'ts-expect-error': 'allow-with-description', 'ts-ignore': true },
63+
],
6164
'@typescript-eslint/no-this-alias': 'off',
6265
'@typescript-eslint/no-unsafe-member-access': 'off',
6366
'@typescript-eslint/no-unsafe-argument': 'off',
64-
'@typescript-eslint/no-explicit-any': 'off',
67+
'@typescript-eslint/no-explicit-any': 'warn',
6568
'@typescript-eslint/no-unsafe-assignment': 'off',
6669
'@typescript-eslint/no-unsafe-call': 'off',
6770
'@typescript-eslint/no-unsafe-return': 'off',

package.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -50,22 +50,22 @@
5050
"postversion": "git push --follow-tags"
5151
},
5252
"devDependencies": {
53-
"@babel/core": "^7.20.5",
54-
"@eslint/js": "^9.7.0",
55-
"@types/node": "^24.10.1",
56-
"@typescript-eslint/eslint-plugin": "^8.48.0",
57-
"@typescript-eslint/parser": "^8.48.0",
58-
"@vitest/coverage-v8": "^4.0.14",
53+
"@babel/core": "^7.29.0",
54+
"@eslint/js": "^10.0.1",
55+
"@types/node": "^25.5.0",
56+
"@typescript-eslint/eslint-plugin": "^8.57.2",
57+
"@typescript-eslint/parser": "^8.57.2",
58+
"@vitest/coverage-v8": "^4.1.1",
5959
"documentation": "^14.0.1",
6060
"eslint": "^9.7.0",
6161
"eslint-plugin-import": "^2.32.0",
62-
"eslint-plugin-unicorn": "^62.0.0",
63-
"prettier": "^3.2.4",
64-
"rimraf": "^6.0.1",
62+
"eslint-plugin-unicorn": "^63.0.0",
63+
"prettier": "^3.8.1",
64+
"rimraf": "^6.1.3",
6565
"standard-changelog": "^7.0.1",
66-
"typescript": "^5.3.3",
67-
"typescript-eslint": "^8.48.0",
68-
"vitest": "^4.0.14"
66+
"typescript": "^6.0.2",
67+
"typescript-eslint": "^8.57.2",
68+
"vitest": "^4.1.1"
6969
},
7070
"keywords": [
7171
"vcf",

src/parse.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export default class VCFParser {
9595
this.metadata[r] = {}
9696
}
9797
const [id, keyVals] = this.parseStructuredMetaVal(metaVal)
98-
if (id) {
98+
if (typeof id === 'string') {
9999
// if there is an ID field in the <> metadata
100100
// e.g. ##INFO=<ID=AF_ESP,...>
101101
;(this.metadata[r] as Record<string, unknown>)[id] = keyVals
@@ -119,8 +119,9 @@ export default class VCFParser {
119119
* and 2) an object with the other key-value pairs in the metadata
120120
*/
121121
private parseStructuredMetaVal(metaVal: string) {
122-
const keyVals = parseMetaString(metaVal)
123-
const id = keyVals.ID!
122+
const keyVals: Record<string, string | string[] | number> =
123+
parseMetaString(metaVal)
124+
const id = keyVals.ID
124125
delete keyVals.ID
125126
if ('Number' in keyVals) {
126127
if (!Number.isNaN(Number(keyVals.Number))) {
@@ -140,10 +141,13 @@ export default class VCFParser {
140141
* @returns {any} An object, string, or number, depending on the filtering
141142
*/
142143
getMetadata(...args: string[]) {
143-
let filteredMetadata: any = this.metadata
144+
let filteredMetadata: unknown = this.metadata
144145
const argsLen = args.length
145146
for (let i = 0; i < argsLen; i++) {
146-
filteredMetadata = filteredMetadata[args[i]!]
147+
if (typeof filteredMetadata !== 'object' || filteredMetadata === null) {
148+
return undefined
149+
}
150+
filteredMetadata = (filteredMetadata as Record<string, unknown>)[args[i]!]
147151
if (!filteredMetadata) {
148152
return filteredMetadata
149153
}

src/parseMetaString.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@ function customSplit(str: string) {
4141

4242
function splitFirst(str: string, split: string) {
4343
const index = str.indexOf(split)
44-
return [str.slice(0, index), str.slice(index + 1)]
44+
return [str.slice(0, index), str.slice(index + 1)] as const
4545
}
4646

4747
export function parseMetaString(metaString: string) {
4848
const inside = metaString.slice(1, -1)
4949
const parts = customSplit(inside)
50-
const entries: [string, any][] = []
50+
const entries: [string, string | string[]][] = []
5151
for (let i = 0; i < parts.length; i++) {
5252
const f = parts[i]!
5353
const [key, val] = splitFirst(f, '=')
@@ -56,11 +56,11 @@ export function parseMetaString(metaString: string) {
5656
for (let j = 0; j < items.length; j++) {
5757
items[j] = items[j]!.trim()
5858
}
59-
entries.push([key!, items])
59+
entries.push([key, items])
6060
} else if (val && val.startsWith('"') && val.endsWith('"')) {
61-
entries.push([key!, val.slice(1, -1)])
61+
entries.push([key, val.slice(1, -1)])
6262
} else {
63-
entries.push([key!, val])
63+
entries.push([key, val])
6464
}
6565
}
6666
return Object.fromEntries(entries)

src/processGenotypes.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22
* Callback type for processGenotypes - receives the raw string and
33
* start/end indices to avoid string allocation
44
*/
5-
export type GenotypeCallback = (str: string, start: number, end: number) => any
5+
export type GenotypeCallback = (
6+
str: string,
7+
start: number,
8+
end: number,
9+
) => unknown
610

711
/**
812
* Process genotypes by calling a callback for each one, avoiding intermediate

test/index.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { describe, expect, it } from 'vitest'
22

3-
import { Breakend, parseBreakend } from '../src'
3+
import { parseBreakend } from '../src'
4+
5+
import type { Breakend } from '../src'
46

57
describe('testBreakend', () => {
68
it('can parse breakends', () => {

tsconfig.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
"compilerOptions": {
44
"outDir": "dist",
55
"lib": ["dom", "esnext"],
6-
"skipLibCheck": true,
76
"declaration": true,
8-
"moduleResolution": "node",
7+
"moduleResolution": "nodenext",
8+
"module": "nodenext",
99
"sourceMap": true,
1010
"strict": true,
1111
"noImplicitReturns": true,

0 commit comments

Comments
 (0)