ts-toolbelt
ts-toolbelt copied to clipboard
`Object.Paths` not produced error with optional sub props.
Hi,
I would like to report a bug.
🐞 Bug Report
Describe the bug
Object.Paths
does not produce an error if optional properties exist in sub properties.
Reproduce the bug
import { Object } from 'ts-toolbelt'
export interface LineItem {
modifications: Record<string, {rate?: number; amount?: number}>
}
export interface Mandatory {
modifications: Record<string, {rate: number; amount: number}>
}
export function useVModel<PROPS extends object, PATH extends Object.Paths<PROPS>>(
props: PROPS,
path: PATH,
): any {}
export function useLineItem(
lineItem: LineItem,
mandatory: Mandatory,
): any {
useVModel(lineItem, ['XXXXXXX']) // First Call
useVModel(mandatory, ['XXXXXXX']) // Second Call
}
Expected behavior
Both calls should produce errors.
What happens
The first call does not produce an error, whereas the second call produces an error.
Screenshots
Additional context
"ts-toolbelt": 9.6.0 "typescript": 4.2.3 "node": 15.8.0
Thanks for reporting this
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Any updates on this issue?