graphql
graphql copied to clipboard
fix(graphql): readonly arrays not allowed in decorator input
PR Checklist
Please check if your PR fulfills the following requirements:
- [x] The commit message follows our guidelines: https://github.com/nestjs/nest/blob/master/CONTRIBUTING.md
- [ ] Tests for the changes have been added (for bug fixes / features)
- [ ] Docs have been added / updated (for bug fixes / features)
PR Type
What kind of change does this PR introduce?
- [x] Bugfix
- [ ] Feature
- [ ] Code style update (formatting, local variables)
- [ ] Refactoring (no functional changes, no api changes)
- [ ] Build related changes
- [ ] CI related changes
- [ ] Other... Please describe:
What is the current behavior?
const interfaces = [A, B] as const;
@ObjectType({
implements: interfaces, // error
})
Does this PR introduce a breaking change?
- [ ] Yes
- [x] No
minor changes to support both array and read only arrays
These represent the same thing. Mutable arrays are a superset of read-only ones. But if this style is preferred I can switch it.
I just noticed something that would break due to that ReadonlyArray:
const imports: ResolveFieldOptions['middleware'] = [];
imports.push(() => {})
because we can't invoke .push on readonly arrays
and I believe that we shouldn't prevent that usage