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

feat!: export and import interfaces as types when using named imports and ESM Module Syntax #1873

Open
wants to merge 2 commits into
base: next
Choose a base branch
from

Conversation

moritzkalwa
Copy link
Contributor

Description

When using modelType 'interface', exportType 'named' and moduleSystem 'ESM' export and import interfaces as types to support verbatimModuleSyntax.
This should not be a breaking change, interfaces are types even when not using verbatimModuleSyntax, explicitly marking them as types is optional in that case though.

Related Issue

fixes #1793

Checklist

  • The code follows the project's coding standards and is properly linted (npm run lint).
  • Tests have been added or updated to cover the changes.
  • Documentation has been updated to reflect the changes.
  • All tests pass successfully locally.(npm run test).

Additional Notes

This PR also includes a change that makes sure only interfaces are imported/exported as types, as the previous version of this PR also exported enums as types.

Copy link

netlify bot commented Mar 9, 2024

Deploy Preview for modelina canceled.

Name Link
🔨 Latest commit 8dff936
🔍 Latest deploy log https://app.netlify.com/sites/modelina/deploys/65ecf7b7e594030008a0904c

Copy link

sonarcloud bot commented Mar 9, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

@coveralls
Copy link

Pull Request Test Coverage Report for Build 8218001195

Details

  • 8 of 9 (88.89%) changed or added relevant lines in 2 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage increased (+0.02%) to 92.323%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/generators/typescript/TypeScriptDependencyManager.ts 5 6 83.33%
Files with Coverage Reduction New Missed Lines %
src/generators/typescript/TypeScriptDependencyManager.ts 1 94.87%
Totals Coverage Status
Change from base Build 8203318802: 0.02%
Covered Lines: 6000
Relevant Lines: 6331

💛 - Coveralls

@jonaslagoni jonaslagoni changed the title feat: export and import interfaces as types when using named imports and ESM Module Syntax feat!: export and import interfaces as types when using named imports and ESM Module Syntax Mar 10, 2024
@jonaslagoni jonaslagoni changed the base branch from master to next March 10, 2024 09:59
@jonaslagoni jonaslagoni changed the base branch from next to master March 10, 2024 09:59
Copy link
Sponsor Member

@jonaslagoni jonaslagoni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gonna have to re-target to next because of the breaking changes to the dependency manager (it's exposed to users). Just need to make a quick update #1876 before I can do it.

Do you mind adding those changes to the migration docs: https://github.com/asyncapi/modelina/blob/next/docs/migrations/version-3-to-4.md

You should be able to easily merge next into your branch 🙂

@jonaslagoni jonaslagoni changed the base branch from master to next March 10, 2024 10:06
Samridhi-98
Samridhi-98 previously approved these changes Mar 18, 2024
@moritzkalwa moritzkalwa dismissed Samridhi-98’s stale review March 18, 2024 16:29

The merge-base changed after approval.

@moritzkalwa
Copy link
Contributor Author

Gonna have to re-target to next because of the breaking changes to the dependency manager (it's exposed to users). Just need to make a quick update #1876 before I can do it.

Do you mind adding those changes to the migration docs: https://github.com/asyncapi/modelina/blob/next/docs/migrations/version-3-to-4.md

You should be able to easily merge next into your branch 🙂

Are you sure this needs to go into the migration guide? This should not break anything afaik, environments that haven't used verbatim module Syntax before should still work with interfaces now exported/imported as types and environments that do will now work without causing errors. 🤔 I could certainly add this into the migration guide, it feels wrong there though as there is no action required.

@jonaslagoni
Copy link
Sponsor Member

Are you sure this needs to go into the migration guide? This should not break anything afaik, environments that haven't used verbatim module Syntax before should still work with interfaces now exported/imported as types and environments that do will now work without causing errors.

Its not the new feature that is breaking, but the syntax of the dependency manager functions, which are public interface for people to use 🙂

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.

Support verbatimModuleSyntax in TypeScript Generator
4 participants