Despite understanding that this TypeScript error is just a warning, I haven't been able to resolve it when it appears on the .map
method.
const files = require.context("./", true, /\.vue$/i);
files.keys().map(key =>
Vue.component(
key
.split("/")
.pop()
.split(".")[0],
files(key).default
)
);
Even after attempting to check if the value of key
exists before proceeding further, the same error persists.
TS2532: Object is possibly 'undefined'.