I'm used to use this type of dynamic method call in vanilla JS with @prismicio/client. But with typeScript, I get an issue :
import Prismic from '@prismicio/client'
const options = {
predicate: 'at',
path: 'document.type',
value: 'page'
}
Prismic.Predicates[options.predicate](options.path, options.value);
Unfortunately the parser tells me this :
{
"resource": "/Users/a143ji/Projects/ai-marketplace-backend/src/prismic.ts",
"owner": "typescript",
"code": "7053",
"severity": 8,
"message": "Element implicitly has an 'any' type because expression of type 'any' can't be used to index type '{ at(fragment: string, value: string | number | boolean | Date | (string | number | boolean | Date)[]): string; not(fragment: string, value: string | number | boolean | Date | (string | ... 2 more ... | Date)[]): string; ... 28 more ...; geopoint: { ...; }; }'.",
"source": "ts",
"startLineNumber": 11,
"startColumn": 16,
"endLineNumber": 11,
"endColumn": 45
}