Skip to content

fix: Missing or incorrect type exports - #2909

Merged
mtrezza merged 27 commits into
parse-community:alphafrom
swittk:fix-type-exports
Feb 9, 2026
Merged

mtrezza merged 27 commits into
parse-community:alphafrom
swittk:fix-type-exports

Conversation

@swittk

@swittk swittk commented Feb 8, 2026 •

Copy link
Copy Markdown
Contributor

Pull Request

Issue

Closes: #2908

Approach

Added types + exported via original type namespaces (e.g. Parse.Object.X, Parse.Query.X) as expected by consumers of previous DefinitelyTyped typings. Some typings that already existed were not exported, and are now exported with this PR at the original locations that users might expect.
Request options are also restored to be more specific (and these specific types exported under their original expected names) instead of the catch-all FullOptions. (one thing of note is I'm not sure if the succes and error params of FullOptions are still in use anywhere; to me it appears as if it's likely a remnant from the pre-promises version? Not sure).

Tasks

  • Add tests

Summary by CodeRabbit

  • New Features

    • Expanded public TypeScript surface: new exported option groups (request/run/signup/send) and richer schema, query, and object typings for batch operations and serialization.
  • Improvements

    • Standardized request/option shapes and updated method signatures across cloud, object, query, schema, push, and user APIs for consistent developer ergonomics.
  • Tests

    • Added a typings exercise to validate the exported type surface.

@parse-github-assistant

Copy link
Copy Markdown

I will reformat the title to use the proper commit message syntax.

@parse-github-assistant parse-github-assistant Bot changed the title fix: type exports to match type definitions + tightened types for functions. fix: Type exports to match type definitions + tightened types for functions. Feb 8, 2026
@parse-github-assistant

parse-github-assistant Bot commented Feb 8, 2026 •

Copy link
Copy Markdown

🚀 Thanks for opening this pull request!

@parseplatformorg

parseplatformorg commented Feb 8, 2026 •

Copy link
Copy Markdown
Contributor

✅ Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
✅ Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@coderabbitai

coderabbitai Bot commented Feb 8, 2026 •

Copy link
Copy Markdown

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.
📝 Walkthrough

Walkthrough

Exported a shared BaseRequestOptions and several previously-internal option/type interfaces across Cloud, ParseObject, ParseQuery, ParseSchema, ParseUser, Push, and RESTController; updated public signatures and type re-exports to use these new exported option/type aliases. (30 words)

Changes

Cohort / File(s) Summary
RESTController base options
src/RESTController.ts, types/RESTController.d.ts
Add exported BaseRequestOptions { useMasterKey?, useMaintenanceKey?, sessionToken?, installationId?, context? }.
Cloud run options
src/Cloud.ts, types/Cloud.d.ts
Introduce/export RunOptions = BaseRequestOptions and update Parse.Cloud.run overloads/implementation to accept options?: RunOptions.
ParseObject public types & options
src/ParseObject.ts, types/ParseObject.d.ts
Export new option interfaces/types (SaveOptions, FetchOptions, DestroyOptions, DestroyAllOptions, SaveAllOptions, FetchAllOptions), attribute types (BaseAttributes, JSONBaseAttributes), Encode, ToJSON, and add ObjectStatic/ObjectConstructor typings; update instance/static signatures (destroy, fetchAll, fetchAllIfNeeded, destroyAll, saveAll).
ParseQuery options & signatures
src/ParseQuery.ts, types/ParseQuery.d.ts
Replace internal FullOptions usage with BaseRequestOptions; add/export QueryOptions, FindOptions, GetOptions, FirstOptions, CountOptions, FullTextOptions, BatchOptions; update get, find, count, first, fullText signatures and import BaseAttributes from ParseObject.
ParseSchema type exports
src/ParseSchema.ts, types/ParseSchema.d.ts
Export schema-related types: TYPE/FieldType, SupportedFieldTypes, FieldOptions<T>, Index, CLPField, CLP, RestSchema; update internal usages to reference these exported types.
ParseUser signUp options
src/ParseUser.ts, types/ParseUser.d.ts
Add exported SignUpOptions { useMasterKey?, installationId? } and update signUp signatures to accept SignUpOptions (keeps context).
Push send options
src/Push.ts, types/Push.d.ts
Add exported SendOptions = FullOptions alias for Push.send (typing-only).
Top-level type exports & namespaces
types/index.d.ts
Re-export new option/types (Cloud, Object, Query, Schema, Push, RESTController); add backward-compatible namespaces (Object, Query, Schema) with alias types.
Type tests & formatting
types/tests.ts
Add test_type_exports to exercise new exports and a TODO for LiveQuery types; no runtime changes.

Sequence Diagram(s)

(omitted)

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested reviewers

  • dplewis
  • mtrezza
🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description check ✅ Passed The description adequately covers the approach and links to the related issue, though it could be more detailed about specific types being restored and the rationale for type tightening.
Linked Issues check ✅ Passed The PR successfully addresses all coding requirements from issue #2908: restores legacy Parse namespace type exports (Parse.Attributes, Parse.BaseAttributes, Parse.JSONBaseAttributes, Parse.Cloud.RunOptions), re-exports option types under their original names (Parse.Query.FindOptions, Parse.Object.FetchOptions, Parse.SignUpOptions), introduces missing namespace types (Parse.ObjectStatic, Parse.RestSchema, Parse.Schema.TYPE), and tightens option type specificity.
Out of Scope Changes check ✅ Passed All changes directly support the objectives of restoring type exports and tightening function types as specified in issue #2908; no out-of-scope modifications were introduced.
Title check ✅ Passed The title 'fix: Missing or incorrect type exports' accurately summarizes the main change—restoring and adding TypeScript type exports to match type definitions.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov

codecov Bot commented Feb 8, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (666bb29) to head (fe6d5e0).
⚠️ Report is 17 commits behind head on alpha.

Additional details and impacted files
@@            Coverage Diff            @@
##             alpha     #2909   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           64        64           
  Lines         6235      6235           
  Branches      1493      1493           
=========================================
  Hits          6235      6235           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Fix all issues with AI agents
In `@src/ParseObject.ts`:
- Around line 64-65: The empty interface DestroyOptions that extends
BaseRequestOptions in ParseObject.ts is triggering the
`@typescript-eslint/no-empty-interface` lint rule; suppress it by adding an inline
eslint-disable comment (e.g., // eslint-disable-next-line
`@typescript-eslint/no-empty-interface`) immediately above the DestroyOptions
declaration so the interface can remain empty for API consistency and future use
without lint errors.
- Around line 2689-2697: Replace the Array<T> syntax with T[] in the
ObjectStatic method signatures: update the parameters in
fetchAllIfNeededWithInclude and fetchAllWithInclude so their second parameter
becomes "keys: keyof U['attributes'] | (keyof U['attributes'])[]" instead of
"Array<keyof U['attributes']>", preserving the generic U, RequestOptions
parameter, and return types exactly as-is.
- Around line 214-215: The template string in the ParseObject method (use
this.className, this.id, this.attributes) is split across two lines causing lint
indentation failures; collapse the multi-line template into a single-line
template string (e.g., return `ParseObject: className: ${this.className}, id:
${this.id} Attributes: ${JSON.stringify(this.attributes, null, 2)}`) inside the
same method so the returned string is identical but satisfies the 2-space
indentation rule.
🧹 Nitpick comments (3)
src/Cloud.ts (1)

42-50: Consider whether FullOptions.success/FullOptions.error should leak into RunOptions.

Since RunOptions extends FullOptions, it now accepts legacy success and error callback fields. The PR description mentions uncertainty about whether these are still used. If they're dead code, consumers could pass them expecting callback behavior that no longer works.

This isn't blocking, but worth a follow-up to confirm whether success/error are honored anywhere in the cloud run path, and if not, consider defining RunOptions without inheriting those fields.

types/ParseUser.d.ts (1)

201-203: Instance signUp uses SignUpOptions but static signUp (line 307) still accepts FullOptions.

The static method delegates to the instance method, so extra fields from FullOptions (e.g., sessionToken, usePost) would be silently passed through _getRequestOptions but likely ignored during sign-up. Consider aligning the static method's options type to SignUpOptions as well for a consistent public API.

src/ParseQuery.ts (1)

25-32: Consider using type aliases instead of empty interface declarations to silence lint warnings.

The linter flags these four empty interfaces. Since they add no members over their supertypes, type aliases are equivalent and lint-clean:

-export interface FindOptions extends QueryOptions { }
-
-/** CountOptions - no json since count() returns a number, not objects */
-export interface CountOptions extends BaseRequestOptions { }
-
-export interface GetOptions extends QueryOptions { }
-
-export interface FirstOptions extends QueryOptions { }
+export type FindOptions = QueryOptions;
+
+/** CountOptions - no json since count() returns a number, not objects */
+export type CountOptions = BaseRequestOptions;
+
+export type GetOptions = QueryOptions;
+
+export type FirstOptions = QueryOptions;

If you intentionally chose interface to allow consumers to use declaration merging (augmenting these types from outside), you can suppress the lint rule instead — just worth documenting that intent.

Comment thread src/ParseObject.ts Outdated
Comment thread src/ParseObject.ts Outdated
Comment thread src/ParseObject.ts Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@types/ParseObject.d.ts`:
- Around line 1096-1099: The instance method signatures
fetchAllIfNeededWithInclude and fetchAllWithInclude incorrectly bind the array
operator before keyof; update their parameter types to mirror the static
signatures by wrapping the attribute lookup in parentheses so the union reads
(keyof U["attributes"]) | (keyof U["attributes"])[] — i.e., use (keyof
U["attributes"])[] when you intend an array of attribute keys for the keys
parameter in both fetchAllIfNeededWithInclude and fetchAllWithInclude to ensure
keyof applies to the attribute type rather than the array.

Comment thread types/ParseObject.d.ts Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In `@src/ParseObject.ts`:
- Around line 48-82: DestroyAllOptions interface is missing the transaction flag
so callers cannot pass options.transaction; update the DestroyAllOptions
declaration (the interface named DestroyAllOptions in ParseObject.ts) to include
transaction?: boolean, mirroring SaveAllOptions, and apply the same addition to
the duplicate declaration in types/ParseObject.d.ts so destroyAll and
DefaultController.destroy can accept options.transaction without a TypeScript
error.

In `@types/ParseObject.d.ts`:
- Around line 34-49: The declaration for DestroyAllOptions is missing the
transaction flag that the implementation (ParseObject.saveAll/related batch
logic) expects; update the DestroyAllOptions interface to include transaction?:
boolean so the types match the implementation (add transaction?: boolean to the
DestroyAllOptions interface alongside batchSize and other BaseRequestOptions
fields).

Comment thread src/ParseObject.ts
Comment thread types/ParseObject.d.ts

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In `@types/ParseObject.d.ts`:
- Around line 1093-1113: The ObjectStatic interface's fromJSON signature omits
the third boolean parameter `dirty` that the class static defines; update
ObjectStatic.fromJSON to include the same optional `dirty?: boolean` parameter
so its signature matches the class static declaration (reference symbols:
ObjectStatic.fromJSON and the class static method static fromJSON<T>(json: any,
override?: boolean, dirty?: boolean): T).
- Around line 1114-1117: The constructor overloads on ObjectConstructor do not
accept the object-form first argument that ParseObject's constructor supports;
update both overload signatures for ObjectConstructor (the two new declarations)
so their first parameter type is string | { className: string; [attr: string]:
any } (or an equivalent union/type alias) instead of just string so callers can
do new ParseObject({ className: 'Foo', ... }) as well as new ParseObject('Foo',
...).

Comment thread types/ParseObject.d.ts
Comment thread types/ParseObject.d.ts

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@src/ParseObject.ts`:
- Around line 2687-2713: The ObjectStatic interface's fromJSON signature is
missing the third parameter "dirty" which the class static defines as static
fromJSON<T>(json: any, override?: boolean, dirty?: boolean): T; update the
ObjectStatic.fromJSON declaration to include the optional dirty?: boolean
parameter (matching the class static) so callers using the ObjectStatic type can
pass the dirty flag; look for the ObjectStatic interface and change its
fromJSON(json: any, override?: boolean) to fromJSON(json: any, override?:
boolean, dirty?: boolean).

Comment thread src/ParseObject.ts
coderabbitai[bot]
coderabbitai Bot previously approved these changes Feb 8, 2026
Comment thread types/tests.ts Outdated
coderabbitai[bot]
coderabbitai Bot previously approved these changes Feb 8, 2026
coderabbitai[bot]
coderabbitai Bot previously approved these changes Feb 8, 2026
Comment thread src/ParseObject.ts Outdated
@mtrezza mtrezza changed the title fix: Type exports to match type definitions + tightened types for functions. fix: Missing or incorrect type exports Feb 9, 2026
coderabbitai[bot]
coderabbitai Bot previously approved these changes Feb 9, 2026
@swittk

swittk commented Feb 9, 2026

Copy link
Copy Markdown
Contributor Author

btw just of note; since there seems to be no .prettierrc, it appears the config that works to restore the typing indentations to the same thing is this (not sure if it's correct; just trial and error'd until it looked the same)

{
  "singleQuote": true,
  "arrowParens": "avoid",
  "trailingComma": "es5",
  "printWidth": 100,
  "semi": true,
  "tabWidth": 2
}

@mtrezza

mtrezza commented Feb 9, 2026

Copy link
Copy Markdown
Member

Interesting, prettier isn't even used in this repo.

@mtrezza
mtrezza merged commit 3caa4ec into parse-community:alpha Feb 9, 2026
13 checks passed
parseplatformorg pushed a commit that referenced this pull request Feb 9, 2026
## [8.1.1-alpha.4](8.1.1-alpha.3...8.1.1-alpha.4) (2026-02-09)

### Bug Fixes

* Missing or incorrect type exports ([#2909](#2909)) ([3caa4ec](3caa4ec))
@parseplatformorg

Copy link
Copy Markdown
Contributor

🎉 This change has been released in version 8.1.1-alpha.4

@parseplatformorg parseplatformorg added the state:released-alpha Released as alpha version label Feb 9, 2026
parseplatformorg pushed a commit that referenced this pull request Feb 20, 2026
# [8.2.0](8.1.0...8.2.0) (2026-02-20)

### Bug Fixes

* `Parse.Object.createWithoutData` doesn't preserve object subclass ([#2907](#2907)) ([01dc94d](01dc94d))
* `Parse.Query.and/or/nor` loosing custom class types ([#2903](#2903)) ([89fdb07](89fdb07))
* `Parse.serverURL` not accessible via global `Parse` scope ([#2917](#2917)) ([4e78681](4e78681))
* Cloud trigger type errors for void returns and subclass constructors ([#2904](#2904)) ([de9f56d](de9f56d))
* Missing or incorrect type exports ([#2909](#2909)) ([3caa4ec](3caa4ec))
* Type error in `Parse.Query.equalTo` when matching optional array ([#2901](#2901)) ([8c96da9](8c96da9))

### Features

* Add request header `X-Parse-Upload-Mode` to identify file upload as binary data via `Buffer`, `Readable`, `ReadableStream` ([#2927](#2927)) ([a66bb06](a66bb06))
* Add support for file upload as binary data via `Buffer`, `Readable`, `ReadableStream` ([#2925](#2925)) ([e42caf6](e42caf6))
@parseplatformorg

Copy link
Copy Markdown
Contributor

🎉 This change has been released in version 8.2.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

state:released Released as stable version state:released-alpha Released as alpha version

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Type regressions: missing Parse namespace exports (options & helper types) after typings migration

3 participants