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

use gulp and gupl-typescript to compile but found error TS2724: '"react"' has no exported member named 'SFCElement'. Did you mean 'CElement'? #675

Open
TinsFox opened this issue Aug 28, 2022 · 1 comment

Comments

@TinsFox
Copy link

TinsFox commented Aug 28, 2022

Expected behavior:
successfully compiled typescript
Actual behavior:
image

Your gulpfile:

var gulp = require('gulp');
var less = require('gulp-less');
var ts = require('gulp-typescript');
gulp.task('default', function () {
    return gulp.src('src/less/index.less')
        .pipe(less())    //编译成为css
        .pipe(gulp.dest('build/css'))    //输出到指定目录
});


gulp.task('ts', function () {
    return gulp.src('src/**/*.ts')
        .pipe(ts({
            noImplicitAny: true,
            outFile: 'output.js'
        }))
        .pipe(gulp.dest('built/local'));
});

Include your gulpfile, or only the related task (with ts.createProject).

gulp.task('ts', function () {
    return gulp.src('src/**/*.ts')
        .pipe(ts({
            noImplicitAny: true,
            outFile: 'output.js'
        }))
        .pipe(gulp.dest('built/local'));
});```

**tsconfig.json**

*Include your tsconfig, if related to this issue.*
```json
{
  "compilerOptions": {
    "module": "commonjs",
    "moduleResolution": "node",
    "target": "ES2019",
    "lib": [
      "ES2019"
    ],
    "strict": true,
    "noEmitOnError": true,
    "declaration": true
  },
  "include": [
    "./src"
  ]
}

Minimal reproducible example
Here is my example: https://github.com/TinsFox/proj

Thanks for answering my question.

@TinsFox
Copy link
Author

TinsFox commented Aug 28, 2022

I solved the problem by deleting the /Users/tinsfox/node_modules directory, but why? Can anyone tell me why?

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

No branches or pull requests

1 participant