I have a function type that has extra properties i.e. nested functions that can be called with dot notation instead of original function: Playground
type FnWithPropFns = {
(param: string): void
nested: (data :string) => void
another: (data :string) => void
}
I wonder whether it is possible to somehow achieve the removal of standard function properties so that they don’t show as completions in IDE. I don’t care about method it could be some transformation of whole type, or whole new definition, I just need to be able to call the function normally or use dot and select from custom properties.
My attempts were done with Omit type, where I tried to remove named property, but the moment I touch the type it breaks the main function, while achieving second part that is removing all function related props.
const test = null as unknown as FnWithPropFns
test('str')
test['nested']('str')
const omitTest = null as unknown as Omit<FnWithPropFns, 'apply'>
omitTest("can't call")
omitTest["nested"]("filtered but broken root fn")