Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Object.Paths not produced error with optional sub props. #224

Open
ozum opened this issue Mar 24, 2021 · 3 comments
Open

Object.Paths not produced error with optional sub props. #224

ozum opened this issue Mar 24, 2021 · 3 comments
Labels
bug Something isn't working
Projects

Comments

@ozum
Copy link

ozum commented Mar 24, 2021

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

image

Additional context

"ts-toolbelt": 9.6.0
"typescript": 4.2.3
"node": 15.8.0

@millsp millsp added the bug Something isn't working label Mar 29, 2021
@millsp
Copy link
Owner

millsp commented Mar 29, 2021

Thanks for reporting this

@millsp millsp added this to To do in Board via automation Mar 29, 2021
@stale
Copy link

stale bot commented Jun 2, 2021

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.

@stale stale bot added the wontfix This will not be worked on label Jun 2, 2021
@stale stale bot closed this as completed Jun 18, 2021
Board automation moved this from To do to Done Jun 18, 2021
@millsp millsp reopened this Sep 3, 2021
Board automation moved this from Done to In progress Sep 3, 2021
@stale stale bot removed the wontfix This will not be worked on label Sep 3, 2021
@yannickpschroeder
Copy link

Any updates on this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Board
  
In progress
Development

No branches or pull requests

3 participants