coreui / coreui-utils Goto Github PK
View Code? Open in Web Editor NEWCoreUI JavaScript utility functions
License: MIT License
CoreUI JavaScript utility functions
License: MIT License
Could you please advise on this as I am getting below error when I try to upgrade from v1.3.1 to v2.0.0.
ERROR in node_modules/@coreui/utils/src/deepObjectsMerge.ts:11:9
TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{}'.
No index signature with a parameter of type 'string' was found on type '{}'.
9 | // Iterate through `source` properties and if an `Object` set property to merge of `target` and `source` properties
10 | for (const key of Object.keys(source)) {
> 11 | if (source[key] instanceof Object) {
| ^^^^^^^^^^^
12 | Object.assign(source[key], deepObjectsMerge(target[key], source[key]))
13 | }
14 | }
ERROR in node_modules/@coreui/utils/src/deepObjectsMerge.ts:12:21
TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{}'.
No index signature with a parameter of type 'string' was found on type '{}'.
10 | for (const key of Object.keys(source)) {
11 | if (source[key] instanceof Object) {
> 12 | Object.assign(source[key], deepObjectsMerge(target[key], source[key]))
| ^^^^^^^^^^^
13 | }
14 | }
15 |
ERROR in node_modules/@coreui/utils/src/deepObjectsMerge.ts:12:51
TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{}'.
No index signature with a parameter of type 'string' was found on type '{}'.
10 | for (const key of Object.keys(source)) {
11 | if (source[key] instanceof Object) {
> 12 | Object.assign(source[key], deepObjectsMerge(target[key], source[key]))
| ^^^^^^^^^^^
13 | }
14 | }
15 |
ERROR in node_modules/@coreui/utils/src/deepObjectsMerge.ts:12:64
TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{}'.
No index signature with a parameter of type 'string' was found on type '{}'.
10 | for (const key of Object.keys(source)) {
11 | if (source[key] instanceof Object) {
> 12 | Object.assign(source[key], deepObjectsMerge(target[key], source[key]))
| ^^^^^^^^^^^
13 | }
14 | }
15 |
ERROR in node_modules/@coreui/utils/src/omitByKeys.ts:12:36
TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{}'.
No index signature with a parameter of type 'string' was found on type '{}'.
10 | const objKeys = Object.keys(originalObject)
11 | for (let i = 0; i < objKeys.length; i++) {
> 12 | !keys.includes(objKeys[i]) && (newObj[objKeys[i]] = originalObject[objKeys[i]])
| ^^^^^^^^^^^^^^^^^^
13 | }
14 | return newObj
15 | }
ERROR in node_modules/@coreui/utils/src/omitByKeys.ts:12:57
TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{}'.
No index signature with a parameter of type 'string' was found on type '{}'.
10 | const objKeys = Object.keys(originalObject)
11 | for (let i = 0; i < objKeys.length; i++) {
> 12 | !keys.includes(objKeys[i]) && (newObj[objKeys[i]] = originalObject[objKeys[i]])
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
13 | }
14 | return newObj
15 | }
ERROR in node_modules/@coreui/utils/src/pickByKeys.ts:11:5
TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{}'.
No index signature with a parameter of type 'string' was found on type '{}'.
9 | const newObj = {}
10 | for (let i = 0; i < keys.length; i++) {
> 11 | newObj[keys[i]] = originalObject[keys[i]]
| ^^^^^^^^^^^^^^^
12 | }
13 | return newObj
14 | }
ERROR in node_modules/@coreui/utils/src/pickByKeys.ts:11:23
TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{}'.
No index signature with a parameter of type 'string' was found on type '{}'.
9 | const newObj = {}
10 | for (let i = 0; i < keys.length; i++) {
> 11 | newObj[keys[i]] = originalObject[keys[i]]
| ^^^^^^^^^^^^^^^^^^^^^^^
12 | }
13 | return newObj
14 | }
Testing the v3-next functionality, the new coreui.Utils.hexToRgba fails on the --info
color code, because it is a 3-digit hex value, instead of a standard 6 digit hex value.
<style>
:root {
--primary: #321fdb;
--secondary: #ced2d8;
--success: #2eb85c;
--info: #39f;
--warning: #f9b115;
--danger: #e55353;
--light: #ebedef;
--dark: #636f83;
--breakpoint-xs: 0;
--breakpoint-sm: 576px;
--breakpoint-md: 768px;
--breakpoint-lg: 992px;
--breakpoint-xl: 1200px;
--font-family-sans-serif: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
--font-family-monospace: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}
</style>
<script src="vendors/@coreui/chartjs/js/coreui-chartjs.bundle.js"></script>
<script src="vendors/@coreui/utils/js/coreui-utils.js"></script>
<script>
console.log(coreui.Utils.getStyle('--info'));
console.log(coreui.Utils.hexToRgba(coreui.Utils.getStyle('--info'), 90));
console.log('#3399ff');
console.log(coreui.Utils.hexToRgba('#3399ff', 90));
</script>
Output in JS console is the following:
#39f
rgba(3, 9, 15, 0.9)
#3399ff
rgba(51, 153, 255, 0.9)
Expected output should be:
#39f
rgba(51, 153, 255, 0.9)
#3399ff
rgba(51, 153, 255, 0.9)
Testing the v3-next functionality, the new coreui.Utils.hexToRgba fails on the --info
color code, because it is a 3-digit hex value, instead of a standard 6 digit hex value.
<style>
:root {
--primary: #321fdb;
--secondary: #ced2d8;
--success: #2eb85c;
--info: #39f;
--warning: #f9b115;
--danger: #e55353;
--light: #ebedef;
--dark: #636f83;
--breakpoint-xs: 0;
--breakpoint-sm: 576px;
--breakpoint-md: 768px;
--breakpoint-lg: 992px;
--breakpoint-xl: 1200px;
--font-family-sans-serif: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
--font-family-monospace: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}
</style>
<script src="vendors/@coreui/chartjs/js/coreui-chartjs.bundle.js"></script>
<script src="vendors/@coreui/utils/js/coreui-utils.js"></script>
<script>
console.log(coreui.Utils.getStyle('--info'));
console.log(coreui.Utils.hexToRgba(coreui.Utils.getStyle('--info'), 90));
console.log('#3399ff');
console.log(coreui.Utils.hexToRgba('#3399ff', 90));
</script>
Output in JS console is the following:
#39f
rgba(3, 9, 15, 0.9)
#3399ff
rgba(51, 153, 255, 0.9)
Expected output should be:
#39f
rgba(51, 153, 255, 0.9)
#3399ff
rgba(51, 153, 255, 0.9)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.