-
-
Notifications
You must be signed in to change notification settings - Fork 372
Closed
Description
I'm trying to get running preact(-cli) with sass and typescript.
What I did is:
- created new project with
--sassand--yarnflags (---type full is by default) - installed
preact-cli-plugin-typescript - renamed
.jsfiles to.tsxfiles - launch
yarn devand see that compilation fails because of
[at-loader] ./src/components/app.tsx:27:13
TS2559: Type '{ onChange: (e: RouterProps) => void; }' has no properties in common with type 'RouterProps & ComponentProps'.
I have 2 questions so far:
- What is the right way to import scss files? So far I ended with something running with
let style = require("./style.scss"), otherwise I was getting module ./style not found during compilation (yarn dev)
but more important: - What is the correct Type/shape of event handler to be used with
<Router onChange={....}>
Does anyone check howpreactworks withtypescript?
I can not find (via Google Search as well 😄) any explanation/example of how to deal with typescript and preact. All examples are very basic, and don't even cover the default skeleton application...
Thanks!
tsconfig.json:
{
"compilerOptions": {
"sourceMap": true,
"jsx": "react",
"jsxFactory": "h",
"typeRoots": ["./node_modules/@types"]
}
}- node --version:
v8.2.1 - npm --version:
5.3.0 - tsc -v:
Version 2.4.2 - preact -v:
preact-cli 1.4.1 - yarn -v:
v0.27.5 - OS:
Darwin Romans-MacBook-Pro.local 16.7.0 Darwin Kernel Version 16.7.0: Thu Jun 15 17:36:27 PDT 2017; root:xnu-3789.70.16~2/RELEASE_X86_64 x86_64
Metadata
Metadata
Assignees
Labels
No labels