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

fix for tsx annoyance #517

Open
Open

Description

@jeremy-coleman

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'))
});

Activity

  1. azizhk commented on May 31, 2019

    @azizhk

    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 join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions