v2.0.0 - Typings issue for Breakpoint and useCurrentWidth/useCurrentBreakpointName
See original GitHub issueThe 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:
- Created 4 years ago
- Comments:14 (9 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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!
Changes published in
v2.0.1
. Thanks @dbryantm @nutboltu @guschnwg! 🎉