Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
(ortsc
if notslint.json
is present).Provide a URL to documentation or source code which provides context for the suggested changes:
import * as css from 'styled-jsx/css'
gives TypeScript error "cannot invoke an expression whose type lacks a call signature ": https://github.com/bensaufley/styled-jsx-example-issues/tree/2a2bef3c9de07a759363577c8cf0cb9f099b57d6 (reproduce by checking out that commit and runningnpm run lint
)import css from 'styled-jsx/css'
sayscss_1.default is not a function
: https://github.com/bensaufley/styled-jsx-example-issues/tree/06221d87582353ef9fbcfaea01e15b3e665c68daIncrease 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 transpilecss`…`
template literals. In practice, this appears to mean that TypeScript never compiles the export ofcss
. Except I'm encountering a separate issue currently wherein I can't getbabel-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):import css from 'styled-jsx/css'
, which doesn't show any errors in Visual Studio Code, throwscss_1.default is not a function
when TypeScript tries to execute it. This is true: the dummy file forstyled-jsx/css
usesmodule.exports = function () { throw … }
so there is no.default
export.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
orimport * 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.