Skip to content

Read-only AST types #1121

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 6, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/execution/values.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ export function getArgumentValues(
*/
export function getDirectiveValues(
directiveDef: GraphQLDirective,
node: { directives?: ?Array<DirectiveNode> },
node: { +directives?: $ReadOnlyArray<DirectiveNode> },
variableValues?: ?ObjMap<mixed>,
): void | { [argument: string]: mixed } {
const directiveNode =
Expand Down
2 changes: 1 addition & 1 deletion src/jsutils/find.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

export default function find<T>(
list: Array<T>,
list: $ReadOnlyArray<T>,
predicate: (item: T) => boolean,
): ?T {
for (let i = 0; i < list.length; i++) {
Expand Down
2 changes: 1 addition & 1 deletion src/jsutils/quotedOrList.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const MAX_LENGTH = 5;
/**
* Given [ A, B, C ] return '"A", "B", or "C"'.
*/
export default function quotedOrList(items: Array<string>): string {
export default function quotedOrList(items: $ReadOnlyArray<string>): string {
const selected = items.slice(0, MAX_LENGTH);
return selected
.map(item => `"${item}"`)
Expand Down
2 changes: 1 addition & 1 deletion src/jsutils/suggestionList.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*/
export default function suggestionList(
input: string,
options: Array<string>,
options: $ReadOnlyArray<string>,
): Array<string> {
const optionsByDistance = Object.create(null);
const oLength = options.length;
Expand Down
20 changes: 10 additions & 10 deletions src/language/__tests__/parser-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ describe('Parser', () => {
kind: Kind.OPERATION_DEFINITION,
loc: { start: 0, end: 40 },
operation: 'query',
name: null,
name: undefined,
variableDefinitions: [],
directives: [],
selectionSet: {
Expand All @@ -231,7 +231,7 @@ describe('Parser', () => {
{
kind: Kind.FIELD,
loc: { start: 4, end: 38 },
alias: null,
alias: undefined,
name: {
kind: Kind.NAME,
loc: { start: 4, end: 8 },
Expand Down Expand Up @@ -261,28 +261,28 @@ describe('Parser', () => {
{
kind: Kind.FIELD,
loc: { start: 22, end: 24 },
alias: null,
alias: undefined,
name: {
kind: Kind.NAME,
loc: { start: 22, end: 24 },
value: 'id',
},
arguments: [],
directives: [],
selectionSet: null,
selectionSet: undefined,
},
{
kind: Kind.FIELD,
loc: { start: 30, end: 34 },
alias: null,
alias: undefined,
name: {
kind: Kind.NAME,
loc: { start: 30, end: 34 },
value: 'name',
},
arguments: [],
directives: [],
selectionSet: null,
selectionSet: undefined,
},
],
},
Expand Down Expand Up @@ -311,7 +311,7 @@ describe('Parser', () => {
kind: Kind.OPERATION_DEFINITION,
loc: { start: 0, end: 29 },
operation: 'query',
name: null,
name: undefined,
variableDefinitions: [],
directives: [],
selectionSet: {
Expand All @@ -321,7 +321,7 @@ describe('Parser', () => {
{
kind: Kind.FIELD,
loc: { start: 10, end: 27 },
alias: null,
alias: undefined,
name: {
kind: Kind.NAME,
loc: { start: 10, end: 14 },
Expand All @@ -336,15 +336,15 @@ describe('Parser', () => {
{
kind: Kind.FIELD,
loc: { start: 21, end: 23 },
alias: null,
alias: undefined,
name: {
kind: Kind.NAME,
loc: { start: 21, end: 23 },
value: 'id',
},
arguments: [],
directives: [],
selectionSet: null,
selectionSet: undefined,
},
],
},
Expand Down
10 changes: 5 additions & 5 deletions src/language/__tests__/schema-parser-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ type Hello {
inputValueNode(
nameNode('flag', { start: 22, end: 26 }),
typeNode('Boolean', { start: 28, end: 35 }),
null,
undefined,
{ start: 22, end: 35 },
),
],
Expand Down Expand Up @@ -481,7 +481,7 @@ type Hello {
type: typeNode('String', { start: 31, end: 37 }),
loc: { start: 30, end: 38 },
},
null,
undefined,
{ start: 22, end: 38 },
),
],
Expand Down Expand Up @@ -518,13 +518,13 @@ type Hello {
inputValueNode(
nameNode('argOne', { start: 22, end: 28 }),
typeNode('Boolean', { start: 30, end: 37 }),
null,
undefined,
{ start: 22, end: 37 },
),
inputValueNode(
nameNode('argTwo', { start: 39, end: 45 }),
typeNode('Int', { start: 47, end: 50 }),
null,
undefined,
{ start: 39, end: 50 },
),
],
Expand Down Expand Up @@ -657,7 +657,7 @@ input Hello {
inputValueNode(
nameNode('world', { start: 17, end: 22 }),
typeNode('String', { start: 24, end: 30 }),
null,
undefined,
{ start: 17, end: 30 },
),
],
Expand Down
Loading