In terms of deprecation strategies, we can mark a value as deprecated and this can imply that 'this thing exists now and should work, but in future major releases this thing may disappear and will break your code'.
eg:
type MyClient = {
/**
@deprecated - prefer using `bar` instead
*/
foo: () => string;
bar: () => Promise<string>;
}
At the same time, in terms of an extensible/non-breaking strategy - we can always allow additional optional inputs to add extra functionality without breaking existing code:
type MyClient = {
/**
@deprecated - prefer using `bar` instead
*/
foo: () => string;
- bar: () => Promise<string>;
+ bar: (options?: {x: boolean}) => Promise<string>;
}
In this scenario, I want to indicate that that options object will be mandatory in future major releases - is there a term for this kind of annotation?
type
).