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

Better separate type declarations #5695

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

mkslanc
Copy link
Contributor

@mkslanc mkslanc commented Dec 10, 2024

Issue #, if available:

Description of changes:
This update builds on the work from #5427 to refine the TypeScript declaration generation, now producing separate, module-specific declaration files.

Benefits:

  • More navigable type definitions
  • Public interfaces split from main declarations
  • Unused imports removed, simplifying code
  • Clearer documentation and enhanced IDE support
  • Aligned with ace-builds and ace-code structures
  • Internal and private elements filtered out

Result:
These changes yield a cleaner, more maintainable public API surface.

Before:
image
After:
image

Discussion Point: Allowing Index Signatures for Classes
We could consider adding an index signature to the class to allow dynamic properties. This can be helpful when properties are not known at compile time but need to be added later.

class Editor {
    [key: string]: any;
    ...
}

While this provides flexibility, it comes at the cost of reduced type safety, as any property can be added without restrictions.
Still could be a good tradeoff for situations like #5696 (comment)

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Pull Request Checklist:

Copy link

One of the public type files has been updated, plase make sure there are no backwards incompatible changes done in the PR.

Copy link

One of the public type files has been updated, plase make sure there are no backwards incompatible changes done in the PR.

Copy link

One of the public type files has been updated, plase make sure there are no backwards incompatible changes done in the PR.

# Conflicts:
#	ace-internal.d.ts
#	ace.d.ts
#	src/autocomplete.js
#	tool/ace_declaration_generator.js
#	tsconfig.json
#	types/ace-ext.d.ts
#	types/ace-lib.d.ts
#	types/ace-modules.d.ts
Copy link

One of the public type files has been updated, plase make sure there are no backwards incompatible changes done in the PR.

Copy link

One of the public type files has been updated, plase make sure there are no backwards incompatible changes done in the PR.

# Conflicts:
#	src/edit_session.js
#	types/ace-modules.d.ts
Copy link

One of the public type files has been updated, plase make sure there are no backwards incompatible changes done in the PR.

@mkslanc mkslanc changed the title WIP: Better separate type declarations Better separate type declarations Dec 17, 2024
@mkslanc mkslanc marked this pull request as ready for review December 17, 2024 11:36
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.

1 participant