question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

v2.0.0 - Typings issue for Breakpoint and useCurrentWidth/useCurrentBreakpointName

See original GitHub issue

The new TypeScript typings break custom breakpoint names for Breakpoint (i.e. sm, md, lg, etc). I currently get the following error:

Type '{ children: Element; sm: true; down: true; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<Breakpoint> & Readonly<Props> & Readonly<{ children?: ReactNode; }>'.
  Property 'sm' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<Breakpoint> & Readonly<Props> & Readonly<{ children?: ReactNode; }>'.

Just a suggestion, but either have a breakpoint prop that accepts a string with the following typing (also probably more maintainable):

interface Props {
  children?: React.ReactNode;
  breakpoint?: string;
  up?: boolean;
  down?: boolean;
  only?: boolean;
  tagName?: string;
  className?: string;
}

Or change the Props typing to the following (which unfortunately lets more in but doesn’t restrict the use of the library):

interface Props<T extends any> {
  children?: React.ReactNode;
  up?: boolean;
  down?: boolean;
  only?: boolean;
  tagName?: string;
  className?: string;
}

Also, you’re missing typings for useCurrentWidth and useCurrentBreakpointName:

export function useCurrentWidth(): number;
export function userCurrentBreakpointName(): string;

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:14 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
dbryantmcommented, Aug 1, 2019

Just an FYI, if you look at the following example:

TypeScript Playground - Proposed Solution Issues

I think we’re going to have to go with something closer to my first suggested solution. I’ll still go ahead and submit a PR but would like to get your thoughts using that as evidence for my findings. Thanks in advance!

1reaction
flexdineshcommented, Aug 4, 2019

Changes published in v2.0.1. Thanks @dbryantm @nutboltu @guschnwg! 🎉

Read more comments on GitHub >

github_iconTop Results From Across the Web

"The breakpoint will not currently be hit. The source code is ...
As it says, the "source code is different from the original version". Right click on the project folder inside the solution explorer and...
Read more >
Troubleshoot Breakpoints in the Visual Studio Debugger
If symbols aren't loaded, check the symbol status to diagnose the issue. From the context menu on a module in the Modules window,...
Read more >
"Breakpoints set but not yet bound" · Issue #2305 · dotnet/sdk
I create a project with "dotnet new angular". When a breakpoint is set on a Typescript instruction, it shows as a open red...
Read more >
KDS 3.2.0 Behavior - NXP Community
We are aware of this issue. The problem is caused by a 2 hardware breakpoint limitation of some KL25 devices and the fact...
Read more >
The breakpoint will not currently be hit. Unable to find a ...
Web, Version=2.0.0.0, Culture=neutral, ... I was still able to use breakpoints without any problems, but I got those warnings as well.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found