Consider this example
interface additonalProperties {
backgroundColor: string,
color: string,
[key: string]: string
}
class StyleObjectMaker implements StyleObjectMaker {
constructor(className: string, additonalProperties: additonalProperties = {}) {
this.key = `button`
this.className = `button${className ? '-' + className : ''}`
this.property = {
backgroundColor: colors[className] || colors.default,
color: colors.default,
...additonalProperties
}
}
}
In the above ts is complaining about
'backgroundColor' is specified more than once, so this usage will be overwritten
And same for
color
Any idea how I can fix it? i.e how can I allow to overwrite
This is how my tsconfig looks
{
"compilerOptions": {
"module": "commonjs",
"noImplicitReturns": true,
"noUnusedLocals": true,
"outDir": "dist/ts-out",
"sourceMap": true,
"strict": true,
"target": "es2017",
"resolveJsonModule": true,
"typeRoots": ["./node_modules/@types"]
},
"compileOnSave": true,
"include": ["src", "index.ts"]
}