Skip to content

Commit

Permalink
convert$ReadOnly (flow) to Readonly (TS)
Browse files Browse the repository at this point in the history
  • Loading branch information
saihaj committed Nov 10, 2020
1 parent bd46482 commit 1d3ca9e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
24 changes: 12 additions & 12 deletions src/type/definition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ export class GraphQLScalarType {
astNode: Maybe<ScalarTypeDefinitionNode>;
extensionASTNodes: Maybe<ReadonlyArray<ScalarTypeExtensionNode>>;

constructor(config: $ReadOnly<GraphQLScalarTypeConfig<unknown, unknown>>) {
constructor(config: Readonly<GraphQLScalarTypeConfig<unknown, unknown>>) {
const parseValue = config.parseValue ?? identityFunc;
this.name = config.name;
this.description = config.description;
Expand Down Expand Up @@ -679,7 +679,7 @@ export class GraphQLObjectType {
_fields: Thunk<GraphQLFieldMap<any, any>>;
_interfaces: Thunk<Array<GraphQLInterfaceType>>;

constructor(config: $ReadOnly<GraphQLObjectTypeConfig<any, any>>) {
constructor(config: Readonly<GraphQLObjectTypeConfig<any, any>>) {
this.name = config.name;
this.description = config.description;
this.isTypeOf = config.isTypeOf;
Expand Down Expand Up @@ -744,9 +744,9 @@ export class GraphQLObjectType {
}

function defineInterfaces(
config: $ReadOnly<
config: Readonly<
| GraphQLObjectTypeConfig<unknown, unknown>
| GraphQLInterfaceTypeConfig<unknown, unknown>,
| GraphQLInterfaceTypeConfig<unknown, unknown>
>,
): Array<GraphQLInterfaceType> {
const interfaces = resolveThunk(config.interfaces) ?? [];
Expand All @@ -758,9 +758,9 @@ function defineInterfaces(
}

function defineFieldMap<TSource, TContext>(
config: $ReadOnly<
config: Readonly<
| GraphQLObjectTypeConfig<TSource, TContext>
| GraphQLInterfaceTypeConfig<TSource, TContext>,
| GraphQLInterfaceTypeConfig<TSource, TContext>
>,
): GraphQLFieldMap<TSource, TContext> {
const fieldMap = resolveThunk(config.fields);
Expand Down Expand Up @@ -993,7 +993,7 @@ export class GraphQLInterfaceType {
_fields: Thunk<GraphQLFieldMap<any, any>>;
_interfaces: Thunk<Array<GraphQLInterfaceType>>;

constructor(config: $ReadOnly<GraphQLInterfaceTypeConfig<any, any>>) {
constructor(config: Readonly<GraphQLInterfaceTypeConfig<any, any>>) {
this.name = config.name;
this.description = config.description;
this.resolveType = config.resolveType;
Expand Down Expand Up @@ -1106,7 +1106,7 @@ export class GraphQLUnionType {

_types: Thunk<Array<GraphQLObjectType>>;

constructor(config: $ReadOnly<GraphQLUnionTypeConfig<any, any>>) {
constructor(config: Readonly<GraphQLUnionTypeConfig<any, any>>) {
this.name = config.name;
this.description = config.description;
this.resolveType = config.resolveType;
Expand Down Expand Up @@ -1161,7 +1161,7 @@ export class GraphQLUnionType {
}

function defineTypes(
config: $ReadOnly<GraphQLUnionTypeConfig<unknown, unknown>>,
config: Readonly<GraphQLUnionTypeConfig<unknown, unknown>>,
): Array<GraphQLObjectType> {
const types = resolveThunk(config.types);
devAssert(
Expand Down Expand Up @@ -1218,7 +1218,7 @@ export class GraphQLEnumType /* <T> */ {
_valueLookup: Map<any /* T */, GraphQLEnumValue>;
_nameLookup: ObjMap<GraphQLEnumValue>;

constructor(config: $ReadOnly<GraphQLEnumTypeConfig /* <T> */>) {
constructor(config: Readonly<GraphQLEnumTypeConfig /* <T> */>) {
this.name = config.name;
this.description = config.description;
this.extensions = config.extensions && toObjMap(config.extensions);
Expand Down Expand Up @@ -1426,7 +1426,7 @@ export class GraphQLInputObjectType {

_fields: Thunk<GraphQLInputFieldMap>;

constructor(config: $ReadOnly<GraphQLInputObjectTypeConfig>) {
constructor(config: Readonly<GraphQLInputObjectTypeConfig>) {
this.name = config.name;
this.description = config.description;
this.extensions = config.extensions && toObjMap(config.extensions);
Expand Down Expand Up @@ -1482,7 +1482,7 @@ export class GraphQLInputObjectType {
}

function defineInputFieldMap(
config: $ReadOnly<GraphQLInputObjectTypeConfig>,
config: Readonly<GraphQLInputObjectTypeConfig>,
): GraphQLInputFieldMap {
const fieldMap = resolveThunk(config.fields);
devAssert(
Expand Down
2 changes: 1 addition & 1 deletion src/type/directives.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export class GraphQLDirective {
extensions: Maybe<ReadOnlyObjMap<unknown>>;
astNode: Maybe<DirectiveDefinitionNode>;

constructor(config: $ReadOnly<GraphQLDirectiveConfig>) {
constructor(config: Readonly<GraphQLDirectiveConfig>) {
this.name = config.name;
this.description = config.description;
this.locations = config.locations;
Expand Down
2 changes: 1 addition & 1 deletion src/type/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export class GraphQLSchema {
// Used as a cache for validateSchema().
__validationErrors: Maybe<ReadonlyArray<GraphQLError>>;

constructor(config: $ReadOnly<GraphQLSchemaConfig>) {
constructor(config: Readonly<GraphQLSchemaConfig>) {
// If this schema was built from a source known to be valid, then it may be
// marked with assumeValid to avoid an additional type system validation.
this.__validationErrors = config.assumeValid === true ? [] : undefined;
Expand Down

0 comments on commit 1d3ca9e

Please sign in to comment.