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

docs(typescript): add triple slash directive #340

Merged
merged 1 commit into from
Oct 11, 2021
Merged

docs(typescript): add triple slash directive #340

merged 1 commit into from
Oct 11, 2021

Conversation

waynevanson
Copy link
Contributor

@waynevanson waynevanson commented Sep 2, 2021

The import statement did not work for me, but this did.

Here is the file I have that now works.

/// <reference types="jest-extended" />

/* eslint-disable @typescript-eslint/no-explicit-any */
declare module "all:part:@sanity/base/schema-type" {
  import { BaseSchemaType } from "@sanity/types"
  const anyArray: BaseSchemaType[]

  export default anyArray
}

declare var GRAPHQL_ENDPOINT: string

What

Why

Notes

Housekeeping

  • Unit tests
  • Documentation is up to date
  • No additional lint warnings
  • Typescript definitions are added/updated where relevant

The import statement did not work for me, but this did.

Here is the file I have that now works.

```ts
/// <reference types="jest-extended" />

/* eslint-disable @typescript-eslint/no-explicit-any */
declare module "all:part:@sanity/base/schema-type" {
  import { BaseSchemaType } from "@sanity/types"
  const anyArray: BaseSchemaType[]

  export default anyArray
}

declare var GRAPHQL_ENDPOINT: string
```
@SimenB
Copy link
Member

SimenB commented Oct 6, 2021

Hmm, that seems better... @orta which is preferred?

Copy link
Member

@SimenB SimenB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@SimenB SimenB merged commit ff02ff1 into jest-community:main Oct 11, 2021
@waynevanson waynevanson deleted the patch-1 branch October 11, 2021 22:26
@orta
Copy link
Member

orta commented Oct 20, 2021

oops, sorry missed this, both are generally valid in different contexts! ( not havng an import statement is useful if the module does something ) otherwise the import really should work, that's a bit surprising IMO

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

Successfully merging this pull request may close these issues.

3 participants