I am puzzled by the 2 eslint errors in this code snippet. The property is declared as a string with a default value:
export default {
name: '...',
props: {
x: {
type: String,
required: true,
default: ''
}
},
setup(props) {
onMounted(async () => {
await MyObject(
{
x: props.x, // <-- eslint warnings
}
).then(...);
The 2 eslint warnings are:
Unsafe assignment of an
any
value.eslint@typescript-eslint/no-unsafe-assignment
Unsafe member access .initialDoc on anany
value.eslint@typescript-eslint/no-unsafe-member-access
The MyObject
function comes from an external library and its declaration is like this:
declare const MyObject: MyObject;
// ...
declare type MyObject = {
(options: MyObjectOptions): Promise<...>
// ...
export type MyObjectOptions = {
x?: string | string[];
}
Despite having well-defined types throughout, why are the eslint warnings showing up?