Skip to content

Commit 05d3827

Browse files
DavertMikclaude
andcommitted
fix(typings): keep helper config types in types.d.ts only
An eighth duplicated *Config typedef makes TypeScript report the conflicts as one file-level error that @ts-ignore cannot suppress. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 7520437 commit 05d3827

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

‎typings/fixDefFiles.js‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ filePath.forEach(file => {
1010
return
1111
}
1212

13-
const modifiedContent = modifyContent(data)
13+
const modifiedContent = modifyContent(file.endsWith('promiseBasedTypes.d.ts') ? removeConfigTypes(data) : data)
1414

1515
// Write the modified content back to the file
1616
fs.writeFile(file, modifiedContent, 'utf8', err => {
@@ -24,6 +24,12 @@ filePath.forEach(file => {
2424
})
2525
})
2626

27+
// Helper config types are emitted into both files; TypeScript stops honouring `@ts-ignore` once
28+
// eight or more identifiers conflict between two files, so keep them in types.d.ts only.
29+
function removeConfigTypes(content) {
30+
return content.replace(/(?: {4}\/\*\*(?:(?!\*\/)[\s\S])*?\*\/\n)? {4}type \w+Config = \{\n[\s\S]*?\n {4}\};\n/g, '')
31+
}
32+
2733
function modifyContent(content) {
2834
const modifiedContent = content
2935
.replace(/ class MockServer {/, ' // @ts-ignore\n' + ' class MockServer {')

0 commit comments

Comments
 (0)