Downgrade styled-components to v5 for TypeScript compatibility

- Downgrade styled-components from v6.1.1 to v5.3.11
- Add @types/styled-components for v5 type definitions
- Simplify styled.ts export (v5 uses default export)
- Remove tsconfig skipLibCheck workaround (not needed with v5)
- Add string-replace-loader dependency for webpack
- Update @pezkuwi/dev to 0.85.4 (includes rollup config export fix)

This fixes TS2742 declaration emit errors that prevented npm
package builds while allowing Chrome/Firefox extension bundles.
This commit is contained in:
2026-01-17 21:08:55 +03:00
parent ebe8d5c499
commit f123bbfacc
6 changed files with 217 additions and 40 deletions
+2 -1
View File
@@ -52,7 +52,7 @@
"react-is": "^18.2.0",
"react-router": "^5.3.4",
"react-router-dom": "^5.3.4",
"styled-components": "^6.1.1",
"styled-components": "^5.3.11",
"tslib": "^2.8.1"
},
"devDependencies": {
@@ -66,6 +66,7 @@
"@types/react-router": "^5.1.20",
"@types/react-router-dom": "^5.3.3",
"@types/sinon-chrome": "^2.2.15",
"@types/styled-components": "^5.1.26",
"@wojtekmaj/enzyme-adapter-react-17": "^0.8.0",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.7",
+1 -12
View File
@@ -1,15 +1,4 @@
// Copyright 2019-2026 @pezkuwi/extension-ui authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { styled } from 'styled-components';
import type { IStyledComponent, RuleSet } from 'styled-components';
// Re-export styled with proper types to avoid TS2742 errors in declaration files
export { styled };
// Helper type for styled component exports - ensures TypeScript can emit declarations
// without referencing internal styled-components paths
export type StyledComponentType<Props extends object = object> = IStyledComponent<'web', Props>;
// Type for the css template literal result
export type StyledCSS<Props extends object = object> = RuleSet<Props>;
export { default as styled } from 'styled-components';
+1 -3
View File
@@ -3,9 +3,7 @@
"compilerOptions": {
"baseUrl": "..",
"outDir": "./build",
"rootDir": "./src",
// Required for styled-components v6 declaration emission compatibility
"skipLibCheck": true
"rootDir": "./src"
},
"exclude": [
"**/*.spec.ts"
+1
View File
@@ -38,6 +38,7 @@
"path-browserify": "^1.0.1",
"process": "^0.11.10",
"stream-browserify": "^3.0.0",
"string-replace-loader": "^3.1.0",
"ts-loader": "^9.5.1",
"url-loader": "^4.1.1",
"webpack-extension-manifest-plugin": "^0.8.0"