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

Update typescript from 4.2.4 to 4.6.4,get error #48947

Closed
keyiis opened this issue May 4, 2022 · 3 comments
Closed

Update typescript from 4.2.4 to 4.6.4,get error #48947

keyiis opened this issue May 4, 2022 · 3 comments
Labels
External Relates to another program, environment, or user action which we cannot control.

Comments

@keyiis
Copy link

keyiis commented May 4, 2022

When I update typescript from 4.2.4 to 4.6.4,I get error

D:/douyin/src/index.ts(1,15): error TS6059: File 'D:/douyin/common/index.ts' is not under 'rootDir' . 'rootDir' is expected to contain all source files.

If I downgrade owngrade typescript to 4.2.4,it works. Therefore, the new version of typescript must have made some adjustments, which led to the problem。I used gulp-typescript to build my app,below is directory structure

d:/douyin
---src
    ---index.ts
---common
    ---index.ts
---tsconfig.json
---gulp.js

tsconfig.json

{
    "compilerOptions": {
        "target": "es6",
        "module": "commonjs",
        "moduleResolution": "node",
        "experimentalDecorators": true,
        "emitDecoratorMetadata": true,
        "removeComments": true,
        "skipLibCheck":true,
        "sourceMap": true,
        "declaration": false,
        "pretty": true,
        "lib": [
            "es2015",
            "es2016",
            "es2017"
        ],
        "baseUrl": ".",
        "paths": {
            "@common/*": [ "src/common/*" ]
        }
    }
}

src/index.ts

import {a} from '@common';
...

gulp.js

const PROJECT_PATH='D:/douyin/src',DIST_PATH='D:/douyin/dist';
gulp.src([`${PROJECT_PATH}/**/*.ts`], { base: `${PROJECT_PATH}` }).pipe(tsProject()).pipe(gulp.dest(DIST_PATH));
@MartinJohns
Copy link
Contributor

It's a gulp-typescript issue: ivogabe/gulp-typescript#667 (comment)

@keyiis
Copy link
Author

keyiis commented May 4, 2022

@MartinJohns Thks reply! If I don't use gulp-typescript, is there any other alternative?

@andrewbranch andrewbranch added the External Relates to another program, environment, or user action which we cannot control. label May 4, 2022
@typescript-bot
Copy link
Collaborator

This issue has been marked as 'External' and has seen no recent activity. It has been automatically closed for house-keeping purposes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
External Relates to another program, environment, or user action which we cannot control.
Projects
None yet
Development

No branches or pull requests

4 participants