Skip to content

Commit

Permalink
fix: make all symbol properties readonly
Browse files Browse the repository at this point in the history
  • Loading branch information
n1ru4l committed Jun 20, 2022
1 parent 3ec488e commit be26b2f
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/error/GraphQLError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export function isGraphQLError(error: unknown): error is GraphQLError {
* GraphQL document and/or execution result that correspond to the Error.
*/
export class GraphQLError extends Error {
[isGraphQLErrorSymbol]: true = true;
readonly [isGraphQLErrorSymbol]: true = true;
/**
* An array of `{ line, column }` locations within the source GraphQL document
* which correspond to this error.
Expand Down
2 changes: 1 addition & 1 deletion src/language/source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const isSourceSymbol = Symbol.for('Source');
* The `line` and `column` properties in `locationOffset` are 1-indexed.
*/
export class Source {
[isSourceSymbol]: true = true;
readonly [isSourceSymbol]: true = true;
body: string;
name: string;
locationOffset: Location;
Expand Down
2 changes: 1 addition & 1 deletion src/type/directives.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const isGraphQLDirectiveSymbol = Symbol.for('GraphQLDirective');
* behavior. Type system creators will usually not create these directly.
*/
export class GraphQLDirective {
[isGraphQLDirectiveSymbol]: true = true;
readonly [isGraphQLDirectiveSymbol]: true = true;
name: string;
description: Maybe<string>;
locations: ReadonlyArray<DirectiveLocation>;
Expand Down
3 changes: 2 additions & 1 deletion src/type/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,12 @@ const isSchemaSymbol = Symbol.for('GraphQLSchema');
* ```
*/
export class GraphQLSchema {
readonly [isSchemaSymbol]: true = true;

description: Maybe<string>;
extensions: Readonly<GraphQLSchemaExtensions>;
astNode: Maybe<SchemaDefinitionNode>;
extensionASTNodes: ReadonlyArray<SchemaExtensionNode>;
[isSchemaSymbol]: true = true;

// Used as a cache for validateSchema().
__validationErrors: Maybe<ReadonlyArray<GraphQLError>>;
Expand Down

0 comments on commit be26b2f

Please sign in to comment.