Skip to content
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

Lacking Typescript declarations #27

Closed
ab-pm opened this issue Dec 10, 2019 · 5 comments
Closed

Lacking Typescript declarations #27

ab-pm opened this issue Dec 10, 2019 · 5 comments

Comments

@ab-pm
Copy link

ab-pm commented Dec 10, 2019

Now that Postgraphile is properly typed, it complains about passing undeclared options… I guess the following should be added to index.d.ts:

declare module 'graphile-build' {
	interface GraphileBuildOptions {
		/**
		* Set to true if you want simple collections to lose the 'List' suffix
		* (and connections to gain a 'Connection' suffix).
		*/
		pgOmitListSuffix: boolean;
		/**
		* Set to false if you want 'userPatch' instead of 'patch' in update
		* mutations.
		*/
		pgSimplifyPatch: boolean;
		/**
		* Set to false if you want 'allUsers' instead of 'users' at root level.
		*/
		pgSimplifyAllRows: boolean;
		/**
		* Set to true if you want primary key queries and mutations to have
		* `ById` (or similar) suffix; and the `nodeId` queries/mutations
		* to lose their `ByNodeId` suffix.
		*/
		pgShortPk: boolean;
	}
}

I'm not exactly sure about the comments though, "set to false" is weird. Is there a @default annotation or something?

@benjie
Copy link
Member

benjie commented Dec 10, 2019

All those should be optional pgSimplifyPatch?: boolean;

I don't know about a @default annotation - have a look at the TSDoc docs 👍

@benjie
Copy link
Member

benjie commented Dec 10, 2019

(Also the inflectors themselves need to have a this: Inflector, argument added as their first argument, python-style (otherwise this is treated as an any)

@ab-pm
Copy link
Author

ab-pm commented Dec 10, 2019

Ah, right, I forgot about making them optional because PostGraphileOptions has a Partial<GraphileBuildOptions> anyway.

@ab-pm
Copy link
Author

ab-pm commented Dec 10, 2019

Looks like TSDoc does not yet support this, the RFC is already implemented by https://api-extractor.com/pages/tsdoc/tag_defaultvalue/ though

@benjie
Copy link
Member

benjie commented Apr 14, 2020

I'm going to close this as the TypeScript types won't be out until V5, and this repo is going to be moving to the graphile-engine monorepo as part of that and being rewritten into TypeScript so it'll become a redundant issue.

@benjie benjie closed this as completed Apr 14, 2020
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

No branches or pull requests

2 participants