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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[styled-jsx] Adjust css export #24771

Merged
merged 1 commit into from
Apr 11, 2018

Conversation

bensaufley
Copy link
Contributor

@bensaufley bensaufley commented Apr 6, 2018

  • Use a meaningful title for the pull request. Include the name of the package modified.

  • Test the change in your own code. (Compile and run.)

  • Add or edit tests to reflect the change. (Run with npm test.)

  • Follow the advice from the readme.

  • Avoid common mistakes.

  • Run npm run lint package-name (or tsc if no tslint.json is present).

  • Provide a URL to documentation or source code which provides context for the suggested changes:

  • Increase the version number in the header if appropriate.
    Looks like this package is at version 2.2.2 but I can't find reference to that anywhere?

  • If you are making substantial changes, consider adding a tslint.json containing { "extends": "dtslint/dt.json" }.
    I'm not making substantial changes

Description of change

styled-jsx uses Babel to transpile css`…` template literals. In practice, this appears to mean that TypeScript never compiles the export of css. Except I'm encountering a separate issue currently wherein I can't get babel-register to intercept and properly interpolate and this code, and so it's making its way to the TypeScript, where I encounter one of two things (mentioned briefly above):

  1. import css from 'styled-jsx/css', which doesn't show any errors in Visual Studio Code, throws css_1.default is not a function when TypeScript tries to execute it. This is true: the dummy file for styled-jsx/css uses module.exports = function () { throw … } so there is no .default export.
  2. import * as css from 'styled-jsx/css', commonly used in TypeScript, gives me an error in Visual Studio Code, passed along from [ts]: "cannot invoke an expression whose type lacks a call signature".

In a browser, either import css or import * as css appears to work, with and without this change—type-checking is apparently ignored and the files make it through Next.js's pipeline just fine. But in mocha, where I'm currently encountering issues hooking in the babel plugin, these changes seem to be the best way to make the Types match up to the output.

@typescript-bot
Copy link
Contributor

typescript-bot commented Apr 6, 2018

@bensaufley Thank you for submitting this PR!

🔔 @R1ZZU - please review this PR in the next few days. Be sure to explicitly select Approve or Request Changes in the GitHub UI so I know what's going on.

If no reviewer appears after a week, a DefinitelyTyped maintainer will review the PR instead.

@typescript-bot typescript-bot added the Unmerged The author did not merge the PR when it was ready. label Apr 11, 2018
@typescript-bot
Copy link
Contributor

After 5 days, no one has reviewed the PR 😞. A maintainer will be reviewing the PR in the next few days and will either merge it or request revisions. Thank you for your patience!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Unmerged The author did not merge the PR when it was ready.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants