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

fix(generators): use export type vs export #3246

Merged
merged 2 commits into from Nov 8, 2023
Merged

Conversation

b-steel
Copy link
Contributor

@b-steel b-steel commented Jul 21, 2023

Summary

Change export { NextFunction } to export type { NextFunction } and change authentication generator to look for either version when inserting new code.

  • Tell us about the problem your pull request is solving.
    I get the following error in src/declarations.ts on the line with export { NextFunction }:
    Re-exporting a type when 'isolatedModules' is enabled requires using 'export type'.ts(1205).

    If that suggestion is followed, then running feathers generate authentication fails since it is looking for the line export { NextFunction } to insert new code after/before.

  • Are there any open issues that are related to this?
    Not that I can find

  • Is this PR dependent on PRs in other repos?
    No

Change one instance of `export { NextFunction }` to
'export type { NextFunction} in `src/app/templates/declarations.tpl.ts`
in the ap generator template.

With the original setup typescript can throw the following error:
`Re-exporting a type when 'isolatedModules' is enabled requires using
'export type'.ts(1205)`

Change the authentication generator template to handle both options
when looking for where to insert new lines.

If someone changes their `declarations.ts` file to have the typescript
required `export type { NextFunction }` then running the command
`feathers generate authentication` will fail looking for `export { NextFunction }`
@daffl
Copy link
Member

daffl commented Oct 11, 2023

I believe this should work and I'm not entirely sure why the tests are failing. Could you merge with latest and see if that works?

@b-steel
Copy link
Contributor Author

b-steel commented Nov 7, 2023

@daffl Yeah I was a bit confused as well, the error from the tests was rather cryptic. I merged the latest and it seems to be passing now.

@daffl daffl merged commit 82d30fd into feathersjs:dove Nov 8, 2023
2 checks passed
@daffl
Copy link
Member

daffl commented Nov 8, 2023

Thank you! Will go out with the next release.

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

Successfully merging this pull request may close these issues.

None yet

2 participants