Skip to content

Improve Typescript support  #7334

Closed
@sadortun

Description

@sadortun

New Feature / Enhancement Checklist

Current Limitation

Continuation of #7287

Current Typescript definitions are out of sync with this repository. Manually updating them in @types/parse is not a viable solution if you want to support the future semantic versioning and gradual rollout of new features, and deprecations.

I see two options to fix this issue. First one is a small incremental step that will solve the issue in the short term, and second option that will enable parse-server to be Typescript compliant.

Feature / Enhancement Description

1. Incremental solution / short term

This is probably something that will take about an hour to put in place and have no backward compatibility issues. I can make a PR in the next days, and then update missing/invalid definitions.

DefinitelyTyped repo is good when the main project doesn't support typescript or types are contributed from a separate entity, but I think in the case of Parse we should have types definitions moved back to the intro parse-server and JS SDK repo.

In addition, expecially considering the plan to include a deprecation strategy that will span on multiple branches (stable, beta, next).

Theses types definitions needs to follow the branch and release cycles.

Its natively supported by package.json and Typescript. I don't see any drawback to dooing this. Or any impact on non-typescript users

This will also ensure that new PR that adds or remove features will have matching Typescript definitions. Otherwise, I have no idea how you can synchronize merged PR additions with the type definitions.

As of now, there is still a lot of incorrect/missing Typescript definitions in Parse-server.

Having theses types in this repo would solve so many issues. Otherwise @types/parse will never be in sync with the actual code.

I can submit a PR about this in the next days, and also fix multiple broken definitions.

As of @types/parse you can leave it in this current state, and in the next releases notes add a deprecation notice to mention the definitions are now part of the project.

2. long term Typescript support

I'm leaving this here, since it's the logical path forward. But we may want to track this in a separate issue.

To make parse-server work with typescript, we first need to rename all js files to ts ( see this issue microsoft/TypeScript#35470 )

After that, we need to evaluate the extent of the changes to make the project 100% typescript.

This is a more complex process that may have backward incompatibilities, and may also cause issue for existing PRs and forks.

Example Use Case

Alternatives / Workarounds

@ts-ignore all errors. Not very practical ....

3rd Party References

PS: I don't want to rush anything, I'm just putting ideas out there :) I wish everybody a great weekend : 🍺

Metadata

Metadata

Assignees

No one assigned

    Labels

    state:released-alphaReleased as alpha versiontype:featureNew feature or improvement of existing feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions