-
Notifications
You must be signed in to change notification settings - Fork 30.2k
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[classnames] Support for ES modules #25206
[classnames] Support for ES modules #25206
Conversation
@alexey-pelykh Thank you for submitting this PR! 🔔 @adidahiya @jkillian @seansfkelley @mradamczyk @marvinhagemeister @NeekSandhu - please review this PR in the next few days. Be sure to explicitly select If no reviewer appears after a week, a DefinitelyTyped maintainer will review the PR instead. |
@alexey-pelykh how does this relate to #25205? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The corresponding change in classNames
hasn't been released yet, so it seems these two PRs should block on that lest you break the entire Typescript-React community. :)
There is a ticket to track this release (JedWatson/classnames#152), which I've taken the liberty of pinging the maintainer on.
@alexey-pelykh One or more reviewers has requested changes. Please address their comments. I'll be back once they sign off or you've pushed new commits or comments. Thank you! |
@seansfkelley the #25205 adds an extra declaration without breaking anything, but I'd rather avoid that approach at all. Indeed, the JedWatson/classnames#152 is not yet there :( I guess it blocks this PR :| |
Got it. Totally agree the default import is stylistically preferable, but such a sudden transition for such a widely-used library seems likely to bring down a rain of complaints and bug reports... #25206 might be the best plan (assuming that the library change ever gets merged). |
#25205 is a workaround that would work until/if classnames gets updated and it would allow to use |
Ooh, I see, I didn't notice that it exposed a different path for the typings. |
@alexey-pelykh I haven't seen anything from you in a while and this PR currently has problems that prevent it from being merged. The PR will be closed tomorrow if there aren't new commits to fix the issues. |
@alexey-pelykh To keep things tidy, we have to close PRs that aren't mergeable but don't have activity from their author. No worries, though - please open a new PR if you'd like to continue with this change. Thank you! |
* Add middle click tab closing (#2069) by adding a onMouseDown directive to both tab file icon and tab name and checking the resulting React.MouseEvent for a middle click * Fix unused imports and whitespace in Tabs ui test (#2069) * Update Tabs component test snapshot (#2069) * Fix Tabs ui test to correctly retrieve children (#2069) * Differentiate between single und multiple tabs in test (#2069) * Use mousedown event for tab selection and closing (#2069) by middle clicking and let the tab itself handle the logic for it by checking React.MouseEvent.button value * Update classnames dependency to lastest master branch and write own @types module declaration so that it can be used in testing nstead of using a mock. The mock does not suffice as the way the actual module previously had to be imported was "import * as classNames" where classNames was the actual function. It is not possible to build a module in typescript/es6 imports, which will directly return a function in the same way the dependency did in commonjs module syntax. Instead when defining a function to be returned as default export it is returned as an Object like this "{ default: [Function] }", which is correctly resolved when importing with "import classNames from 'classnames'". This only previously worked in production as webpacks ts-loader, handles this issue, whereas when testing the sources are only compiled with tsc. There is an update to the classnames dependency on the current master, but there hasn't been a release since 2006. So options were to setup webpack for tests as well or add updated classnames dependency which sets a "default" value on its commonjs exports. Links for reference: JedWatson/classnames#152 JedWatson/classnames#106 DefinitelyTyped/DefinitelyTyped#25206 microsoft/TypeScript#2719 * Fix tab click onMouseDown callback * Test tab clicks to select/close trigger callbacks * Mock child react components directly to test smaller unit * Reset calls to callback mocks in each test case * Add tests for tabs interaction with FileIcon/Sneakable
Please fill in this template.
npm test
.)npm run lint package-name
(ortsc
if notslint.json
is present).Select one of these and delete the others:
If adding a new definition:
.d.ts
files generated via--declaration
dts-gen --dt
, not by basing it on an existing project.tslint.json
should be present, andtsconfig.json
should havenoImplicitAny
,noImplicitThis
,strictNullChecks
, andstrictFunctionTypes
set totrue
.If changing an existing definition:
tslint.json
containing{ "extends": "dtslint/dt.json" }
.If removing a declaration:
notNeededPackages.json
.