The type definition for MappingGenericProperty has mandatory fields
How can one reproduce the bug?
Try to compile this code:
import { MappingTypeMapping } from "@opensearch-project/opensearch/api/types";
const x = { foo: { type: "date" } };
const f = (p: MappingTypeMapping["properties"]) => p;
f(x);
An error is reported:
TSError: ⨯ Unable to compile TypeScript:
bug.ts:4:3 - error TS2345: Argument of type '{ foo: { type: string; }; }' is not assignable to parameter of type 'Record<string, MappingProperty>'.
Property 'foo' is incompatible with index signature.
Type '{ type: string; }' is not assignable to type 'MappingProperty'.
Type '{ type: string; }' is missing the following properties from type 'MappingGenericProperty': analyzer, boost, fielddata, ignore_malformed, and 7 more.
4 f(x);
What is the expected behavior?
It should compile ok.
What is your host/environment?
node 18, typescript 5.2.2
Do you have any screenshots?
N/A
Do you have any additional context?
It appears that the other similar types do have optional fields, but the "generic" version is the odd one out.
What is the bug?
The type definition for MappingGenericProperty has mandatory fields
How can one reproduce the bug?
Try to compile this code:
An error is reported:
What is the expected behavior?
It should compile ok.
What is your host/environment?
node 18, typescript 5.2.2
Do you have any screenshots?
N/A
Do you have any additional context?
It appears that the other similar types do have optional fields, but the "generic" version is the odd one out.