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

prevent third-party types in twoslash snippets #3309

Merged
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: 2 additions & 0 deletions packages/documentation/copy/en/javascript/JSDoc Reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ myPet.name;
import types can be used to get the type of a value from a module if you don't know the type, or if it has a large type that is annoying to type:

```js twoslash
// @types: node
jakebailey marked this conversation as resolved.
Show resolved Hide resolved
// @filename: accounts.d.ts
export const userAccount = {
name: "Name",
Expand Down Expand Up @@ -746,6 +747,7 @@ Otherwise, `@example` will be parsed as a new tag.
### Other supported patterns

```js twoslash
// @types: react
class Foo {}
// ---cut---
var someObj = {
Expand Down
6 changes: 6 additions & 0 deletions packages/typescriptlang-org/gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ if (process.env.BOOTSTRAPPING) {

require("./scripts/ensureDepsAreBuilt")

const ts = require("typescript");

// https://github.com/gatsbyjs/gatsby/issues/1457
require("ts-node").register({ files: true })
const { join } = require("path")
Expand Down Expand Up @@ -158,6 +160,10 @@ module.exports = {
defaultOptions: {
noErrorValidation: true,
},
defaultCompilerOptions: {
types: [],
target: ts.ScriptTarget.ES2020,
},
},
},
"gatsby-remark-copy-linked-files",
Expand Down
Loading