Skip to content

export Query class value so it can be instanceof'd - #327

Open
ssttevee wants to merge 1 commit into
fauna:mainfrom
ssttevee:query-instanceof
Open

export Query class value so it can be instanceof'd#327
ssttevee wants to merge 1 commit into
fauna:mainfrom
ssttevee:query-instanceof

Conversation

@ssttevee

Copy link
Copy Markdown

Description

Export the actual value of Query instead of just the type declaration so it can be used with instanceof.

Motivation and context

I need to distinguish and handle Querys separately from other values.

To achieve this right now, I make an alias like this, which doesn't work well with typescript:

const Query = fql([]).constructor;

How was the change tested?

Screenshots (if appropriate):

Change types

    • Bug fix (non-breaking change that fixes an issue)
    • New feature (non-breaking change that adds functionality)
    • Breaking change (backwards-incompatible fix or feature)

Checklist:

    • My code follows the code style of this project.
    • My change requires a change to Fauna documentation.
    • My change requires a change to the README, and I have updated it accordingly.

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

@ssttevee
ssttevee requested a review from a team as a code owner February 25, 2025 18:15

@ptpaterson ptpaterson left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @ssttevee! I agree marking Query as only a type was probably a mistake.

@ptpaterson
ptpaterson enabled auto-merge (squash) February 25, 2025 18:48
@ssttevee

Copy link
Copy Markdown
Author

@ptpaterson is there something blocking the workflows from running?

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.

2 participants