Skip to content
This repository has been archived by the owner on Dec 16, 2021. It is now read-only.

fix for tsx annoyance #517

Open
jeremy-coleman opened this issue Dec 28, 2018 · 1 comment
Open

fix for tsx annoyance #517

jeremy-coleman opened this issue Dec 28, 2018 · 1 comment

Comments

@jeremy-coleman
Copy link

any better solution than this?lol

var gulp = require('gulp');
var replace = require('gulp-batch-replace');
var rename = require('gulp-rename')

let t1 = "= preact"
let t2 = "namespace preact"
let r1 = "= React"
let r2 = "namespace React"

var replacements = [
	[ t1, r1 ],
    [ t2, r2]
]

gulp.task('setup', () => {
        return gulp.src('node_modules/preact/src/preact.d.ts')
        .pipe(replace(replacements))
        .pipe(rename('index.d.ts'))
        .pipe(gulp.dest('node_modules/@types/react'))
});
@azizhk
Copy link

azizhk commented May 31, 2019

One more method can be to add aliases in your tsconfig.json

{
  "compilerOptions": {
    "paths": {
      "react": ["preact-compact"],
      "react-dom": ["preact-compact"]
    }
  }
}

You would have to alias the same in your build tools as well. (Webpack etc.)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants