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

[BUG] Minor issues with generated code #365

Closed
1 task
KBroichhausen opened this issue Feb 12, 2024 · 4 comments
Closed
1 task

[BUG] Minor issues with generated code #365

KBroichhausen opened this issue Feb 12, 2024 · 4 comments
Assignees
Labels

Comments

@KBroichhausen
Copy link

Information

  • Version: 5.0.2
  • Packages:
> tsed init .
? Choose the target platform: Express.js
? Choose the architecture for your project: Ts.ED     
? Choose the convention file styling: Ts.ED
? Check the features needed for your project Database, Swagger, Testing, Linter
? Choose a ORM manager TypeORM
? Which TypeORM you want to install? Postgres
? Choose unit framework Jest
? Choose linter tools framework EsLint
? Choose extra linter tools Prettier, Lint on commit
? Choose the runtime: Node.js + Babel
? Choose the package manager: NPM

Following compile erros occur:

> npm run build

> tsedtest@1.0.0 build
> npm run barrels && tsc && babel src --out-dir dist --extensions ".ts,.tsx" --source-maps inline

> tsedtest@1.0.0 barrels
> barrelsby --config .barrelsby.json

src/config/index.ts:2:9 - error TS2305: Module '"./envs/index"' has no exported member 'envs'.

2 import {envs} from "./envs/index";
          ~~~~

src/datasources/PostgresDatasource.spec.ts:9:39 - error TS2749: 'PostgresDatasource' refers to a value, but is being used as a type here. Did you mean 'typeof PostgresDatasource'?

9     const instance = PlatformTest.get<PostgresDatasource>(PostgresDatasource);
                                        ~~~~~~~~~~~~~~~~~~

src/Server.integration.spec.ts:10:5 - error TS2322: Type 'TestAgent<Test>' is not assignable to type 'SuperTest<Test>'.
  Type 'TestAgent<Test>' is missing the following properties from type 'Stream': pipe, compose, addListener, removeListener, and 11 more.

10     request = SuperTest(PlatformTest.callback());
       ~~~~~~~

./envs/index only exports config and isProduction. I guess config should be imported in src/config/index.ts but that would also clash with the file defining export const config by itself. Maybe import like import {config as envConfig} from "./envs/index"; should be considered.

PostgresDatasource is actually the name from the exported DataSource. I guess it should be const instance = PlatformTest.get<DataSource>(PostgresDatasource); where DataSource is the type from typeorm package.

Never used SuperTest but the type seems to be just let request: SuperTest.Agent; instead of let request: SuperTest.SuperTest<SuperTest.Test>;

After fixing this, I get: Error: Cannot find package '@babel/plugin-proposal-object-rest-spread' [...]. Should be installed by the CLI.

Also the CLI page doesn't work: https://cli.tsed.io/

Example

Just follow the posted interaction with tsed cli.

Acceptance criteria

  • Criteria 1
@lunagloaming
Copy link

I can confirm tsed init appears to work fine in release 5.0.1 as I was starting a new project and ran into this right away.
(( At least, it doesn't exhibit the error on yarn build. ))

@Romakita
Copy link
Contributor

Romakita commented Mar 2, 2024

Hello @KBroichhausen
Thanks for this issue. I'll try to fix that asap :)

Romakita added a commit that referenced this issue Mar 2, 2024
Romakita added a commit that referenced this issue Mar 2, 2024
Romakita added a commit that referenced this issue Mar 2, 2024
Romakita added a commit that referenced this issue Mar 2, 2024
Copy link

github-actions bot commented Mar 2, 2024

🎉 Are you happy?

If you appreciated the support, know that it is free and is carried out on personal time ;)

A support, even a little bit makes a difference for me and continues to bring you answers!

github opencollective

@Romakita
Copy link
Contributor

Romakita commented Mar 3, 2024

🎉 This issue has been resolved in version 5.0.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

No branches or pull requests

3 participants