Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 05494e7

Browse files
ericapisaniErica Pisanikodiakhq[bot]
authoredApr 4, 2022
chore: convert repository to Typescript (#109)
* chore: [ts-migrate] Init tsconfig.json file Co-authored-by: ts-migrate <> * chore: [ts-migrate] Rename files from JS/JSX to TS/TSX Co-authored-by: ts-migrate <> * chore: Convert JS files to TS * chore: Update snapshot file to use Typescript file extension * chore: Remove ts-migrate dependency now that project has been converted to Typescript * chore: Add Jest Typescript types. Remove ts-expect-error comments that were introduced during initial migration with the ts-migrate tool now that the types are available in the project. * chore: Make changes needed to remove the last ts-expect-error comments Co-authored-by: Erica Pisani <[email protected]> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
1 parent 6358e44 commit 05494e7

12 files changed

+459
-471
lines changed
 

‎package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"@babel/eslint-parser": "^7.16.5",
2727
"@babel/eslint-plugin": "^7.16.5",
2828
"@netlify/eslint-config-node": "^5.1.8",
29+
"@types/jest": "^27.4.1",
2930
"babel-preset-gatsby-package": "^2.5.0",
3031
"cross-env": "^7.0.3",
3132
"gatsby": "^4.5.3",
@@ -51,7 +52,8 @@
5152
"url": "https://github.com/netlify/gatsby-plugin-netlify.git"
5253
},
5354
"scripts": {
54-
"build": "babel src --out-dir . --ignore \"**/__tests__\"",
55+
"build": "tsc && cd src/__tests__ && tsc",
56+
"clean": "tsc --build --clean",
5557
"prepare": "cross-env NODE_ENV=production npm run build",
5658
"prepublishOnly": "npm run prepare",
5759
"format": "npm run format:code && npm run format:other",
@@ -60,7 +62,7 @@
6062
"lint": "eslint --ext .js,.jsx,.ts,.tsx .",
6163
"prettier": "prettier \"**/*.{md,css,scss,yaml,yml}\"",
6264
"test": "jest",
63-
"watch": "babel -w src --out-dir . --ignore \"**/__tests__\""
65+
"watch": "tsc --watch"
6466
},
6567
"engines": {
6668
"node": ">=12.13.0"

‎src/__tests__/build-headers-program.js renamed to ‎src/__tests__/build-headers-program.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -171,17 +171,20 @@ const createPluginData = async () => {
171171
],
172172
},
173173
pathPrefix: ``,
174-
publicFolder: (...files) => join(tmpDir, ...files),
174+
publicFolder: (...files: any[]) => join(tmpDir, ...files),
175175
}
176176
}
177177

178-
jest.mock(`fs-extra`, () => ({
179-
...jest.requireActual(`fs-extra`),
180-
existsSync: jest.fn(),
181-
}))
178+
jest.mock(`fs-extra`, () => {
179+
const actualFsExtra = jest.requireActual(`fs-extra`)
180+
return {
181+
...actualFsExtra,
182+
existsSync: jest.fn(),
183+
}
184+
})
182185
// eslint-disable-next-line max-lines-per-function
183186
describe(`build-headers-program`, () => {
184-
let reporter
187+
let reporter: any
185188

186189
beforeEach(() => {
187190
reporter = {
@@ -213,7 +216,7 @@ describe(`build-headers-program`, () => {
213216
it(`with manifest['pages-manifest']`, async () => {
214217
const pluginData = await createPluginData()
215218

216-
existsSync.mockImplementation((path) => !path.includes(`page-data.json`) && !path.includes(`app-data.json`))
219+
existsSync.mockImplementation((path: any) => !path.includes(`page-data.json`) && !path.includes(`app-data.json`))
217220

218221
// gatsby < 2.9 uses page-manifest
219222
pluginData.manifest[`pages-manifest`] = [`pages-manifest-ab11f09e0ca7ecd3b43e.js`]
@@ -244,7 +247,7 @@ describe(`build-headers-program`, () => {
244247
...DEFAULT_OPTIONS,
245248
mergeCachingHeaders: true,
246249
}
247-
existsSync.mockImplementation((path) => !path.includes(`app-data.json`))
250+
existsSync.mockImplementation((path: any) => !path.includes(`app-data.json`))
248251

249252
await buildHeadersProgram(pluginData, pluginOptions, reporter)
250253

File renamed without changes.

‎src/__tests__/tsconfig.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"extends": "../../tsconfig.json",
3+
"compilerOptions": {
4+
"noEmit": true,
5+
}
6+
}

‎src/build-headers-program.js renamed to ‎src/build-headers-program.ts

Lines changed: 80 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ import {
1616
PAGE_DATA_DIR,
1717
} from './constants'
1818

19-
const getHeaderName = (header) => {
19+
const getHeaderName = (header: any) => {
2020
const matches = header.match(/^([^:]+):/)
2121
return matches && matches[1]
2222
}
2323

24-
const validHeaders = (headers, reporter) => {
24+
const validHeaders = (headers: any, reporter: any) => {
2525
if (!headers || !_.isObject(headers)) {
2626
return false
2727
}
@@ -40,20 +40,20 @@ const validHeaders = (headers, reporter) => {
4040
)
4141
}
4242

43-
const linkTemplate = (assetPath, type = `script`) =>
43+
const linkTemplate = (assetPath: any, type = `script`) =>
4444
`Link: <${assetPath}>; rel=preload; as=${type}${type === `fetch` ? `; crossorigin` : ``}`
4545

46-
const pathChunkName = (path) => {
46+
const pathChunkName = (path: any) => {
4747
const name = path === `/` ? `index` : kebabHash(path)
4848
return `path---${name}`
4949
}
5050

51-
const getPageDataPath = (path) => {
51+
const getPageDataPath = (path: any) => {
5252
const fixedPagePath = path === `/` ? `index` : path
5353
return posix.join(`page-data`, fixedPagePath, `page-data.json`)
5454
}
5555

56-
const getScriptPath = (file, manifest) => {
56+
const getScriptPath = (file: any, manifest: any) => {
5757
const chunk = manifest[file]
5858

5959
if (!chunk) {
@@ -71,14 +71,19 @@ const getScriptPath = (file, manifest) => {
7171
})
7272
}
7373

74-
const getLinkHeaders = (filesByType, pathPrefix) =>
75-
Object.entries(filesByType).flatMap(([type, files]) =>
74+
const getLinkHeaders = (filesByType: any, pathPrefix: any) =>
75+
Object.entries(filesByType).flatMap(([type, files]: [string, Array<string>]) =>
7676
files.map((file) => linkTemplate(`${pathPrefix}/${file}`, type)),
7777
)
7878

79-
const headersPath = (pathPrefix, path) => `${pathPrefix}${path}`
79+
const headersPath = (pathPrefix: any, path: any) => `${pathPrefix}${path}`
8080

81-
const preloadHeadersByPage = ({ pages, manifest, pathPrefix, publicFolder }) => {
81+
const preloadHeadersByPage = ({
82+
pages,
83+
manifest,
84+
pathPrefix,
85+
publicFolder
86+
}: any) => {
8287
const linksByPage = {}
8388

8489
const appDataPath = publicFolder(PAGE_DATA_DIR, `app-data.json`)
@@ -91,7 +96,7 @@ const preloadHeadersByPage = ({ pages, manifest, pathPrefix, publicFolder }) =>
9196
hasPageData = existsSync(pageDataPath)
9297
}
9398

94-
pages.forEach((page) => {
99+
pages.forEach((page: any) => {
95100
const scripts = _.flatMap(COMMON_BUNDLES, (file) => getScriptPath(file, manifest))
96101
scripts.push(
97102
...getScriptPath(pathChunkName(page.path), manifest),
@@ -119,8 +124,8 @@ const preloadHeadersByPage = ({ pages, manifest, pathPrefix, publicFolder }) =>
119124
return linksByPage
120125
}
121126

122-
const defaultMerge = (...headers) => {
123-
const unionMerge = (objValue, srcValue) => {
127+
const defaultMerge = (...headers: any[]) => {
128+
const unionMerge = (objValue: any, srcValue: any) => {
124129
if (Array.isArray(objValue)) {
125130
return _.union(objValue, srcValue)
126131
}
@@ -130,18 +135,18 @@ const defaultMerge = (...headers) => {
130135
return _.mergeWith({}, ...headers, unionMerge)
131136
}
132137

133-
const headersMerge = (userHeaders, defaultHeaders) => {
138+
const headersMerge = (userHeaders: any, defaultHeaders: any) => {
134139
const merged = {}
135140
Object.keys(defaultHeaders).forEach((path) => {
136141
if (!userHeaders[path]) {
137142
merged[path] = defaultHeaders[path]
138143
return
139144
}
140145
const headersMap = {}
141-
defaultHeaders[path].forEach((header) => {
146+
defaultHeaders[path].forEach((header: any) => {
142147
headersMap[getHeaderName(header)] = header
143148
})
144-
userHeaders[path].forEach((header) => {
149+
userHeaders[path].forEach((header: any) => {
145150
// override if exists
146151
headersMap[getHeaderName(header)] = header
147152
})
@@ -155,34 +160,32 @@ const headersMerge = (userHeaders, defaultHeaders) => {
155160
return merged
156161
}
157162

158-
const transformLink = (manifest, publicFolder, pathPrefix) => (header) =>
159-
header.replace(LINK_REGEX, (__, prefix, file, suffix) => {
160-
const hashed = manifest[file]
161-
if (hashed) {
162-
return `${prefix}${pathPrefix}${hashed}${suffix}`
163-
}
164-
if (existsSync(publicFolder(file))) {
165-
return `${prefix}${pathPrefix}${file}${suffix}`
166-
}
167-
throw new Error(
168-
`Could not find the file specified in the Link header \`${header}\`.` +
169-
`The gatsby-plugin-netlify is looking for a matching file (with or without a ` +
170-
`webpack hash). Check the public folder and your gatsby-config.js to ensure you are ` +
171-
`pointing to a public file.`,
172-
)
173-
})
163+
const transformLink = (manifest: any, publicFolder: any, pathPrefix: any) => (header: any) => header.replace(LINK_REGEX, (__: any, prefix: any, file: any, suffix: any) => {
164+
const hashed = manifest[file]
165+
if (hashed) {
166+
return `${prefix}${pathPrefix}${hashed}${suffix}`
167+
}
168+
if (existsSync(publicFolder(file))) {
169+
return `${prefix}${pathPrefix}${file}${suffix}`
170+
}
171+
throw new Error(
172+
`Could not find the file specified in the Link header \`${header}\`.` +
173+
`The gatsby-plugin-netlify is looking for a matching file (with or without a ` +
174+
`webpack hash). Check the public folder and your gatsby-config.js to ensure you are ` +
175+
`pointing to a public file.`,
176+
)
177+
})
174178

175179
// Writes out headers file format, with two spaces for indentation
176180
// https://www.netlify.com/docs/headers-and-basic-auth/
177-
const stringifyHeaders = (headers) =>
178-
Object.entries(headers).reduce((text, [path, headerList]) => {
179-
const headersString = headerList.reduce((accum, header) => `${accum} ${header}\n`, ``)
180-
return `${text}${path}\n${headersString}`
181-
}, ``)
181+
const stringifyHeaders = (headers: any) => Object.entries(headers).reduce((text, [path, headerList]: [string, Array<string>]) => {
182+
const headersString = headerList.reduce((accum, header) => `${accum} ${header}\n`, ``)
183+
return `${text}${path}\n${headersString}`
184+
}, ``)
182185

183186
// program methods
184187

185-
const validateUserOptions = (pluginOptions, reporter) => (headers) => {
188+
const validateUserOptions = (pluginOptions: any, reporter: any) => (headers: any) => {
186189
if (!validHeaders(headers, reporter)) {
187190
throw new Error(
188191
`The "headers" option to gatsby-plugin-netlify is in the wrong shape. ` +
@@ -192,7 +195,7 @@ const validateUserOptions = (pluginOptions, reporter) => (headers) => {
192195
)
193196
}
194197

195-
;[`mergeSecurityHeaders`, `mergeLinkHeaders`, `mergeCachingHeaders`].forEach((mergeOption) => {
198+
[`mergeSecurityHeaders`, `mergeLinkHeaders`, `mergeCachingHeaders`].forEach((mergeOption) => {
196199
if (!_.isBoolean(pluginOptions[mergeOption])) {
197200
throw new TypeError(
198201
`The "${mergeOption}" option to gatsby-plugin-netlify must be a boolean. Check your gatsby-config.js.`,
@@ -212,18 +215,23 @@ const validateUserOptions = (pluginOptions, reporter) => (headers) => {
212215
}
213216

214217
const mapUserLinkHeaders =
215-
({ manifest, pathPrefix, publicFolder }) =>
216-
(headers) =>
217-
Object.fromEntries(
218-
Object.entries(headers).map(([path, headerList]) => [
219-
path,
220-
headerList.map(transformLink(manifest, publicFolder, pathPrefix)),
221-
]),
222-
)
218+
({
219+
manifest,
220+
pathPrefix,
221+
publicFolder
222+
}: any) =>
223+
(headers: any) => Object.fromEntries(
224+
Object.entries(headers).map(([path, headerList]: [string, Array<string>]) => [
225+
path,
226+
headerList.map(transformLink(manifest, publicFolder, pathPrefix)),
227+
]),
228+
)
223229

224230
const mapUserLinkAllPageHeaders =
225-
(pluginData, { allPageHeaders }) =>
226-
(headers) => {
231+
(pluginData: any, {
232+
allPageHeaders
233+
}: any) =>
234+
(headers: any) => {
227235
if (!allPageHeaders) {
228236
return headers
229237
}
@@ -233,7 +241,7 @@ const mapUserLinkAllPageHeaders =
233241
const headersList = allPageHeaders.map(transformLink(manifest, publicFolder, pathPrefix))
234242

235243
const duplicateHeadersByPage = {}
236-
pages.forEach((page) => {
244+
pages.forEach((page: any) => {
237245
const pathKey = headersPath(pathPrefix, page.path)
238246
duplicateHeadersByPage[pathKey] = headersList
239247
})
@@ -242,8 +250,10 @@ const mapUserLinkAllPageHeaders =
242250
}
243251

244252
const applyLinkHeaders =
245-
(pluginData, { mergeLinkHeaders }) =>
246-
(headers) => {
253+
(pluginData: any, {
254+
mergeLinkHeaders
255+
}: any) =>
256+
(headers: any) => {
247257
if (!mergeLinkHeaders) {
248258
return headers
249259
}
@@ -260,8 +270,10 @@ const applyLinkHeaders =
260270
}
261271

262272
const applySecurityHeaders =
263-
({ mergeSecurityHeaders }) =>
264-
(headers) => {
273+
({
274+
mergeSecurityHeaders
275+
}: any) =>
276+
(headers: any) => {
265277
if (!mergeSecurityHeaders) {
266278
return headers
267279
}
@@ -270,8 +282,10 @@ const applySecurityHeaders =
270282
}
271283

272284
const applyCachingHeaders =
273-
(pluginData, { mergeCachingHeaders }) =>
274-
(headers) => {
285+
(pluginData: any, {
286+
mergeCachingHeaders
287+
}: any) =>
288+
(headers: any) => {
275289
if (!mergeCachingHeaders) {
276290
return headers
277291
}
@@ -301,18 +315,20 @@ const applyCachingHeaders =
301315
}
302316

303317
const applyTransfromHeaders =
304-
({ transformHeaders }) =>
305-
(headers) =>
306-
_.mapValues(headers, transformHeaders)
318+
({
319+
transformHeaders
320+
}: any) =>
321+
(headers: any) => _.mapValues(headers, transformHeaders)
307322

308-
const transformToString = (headers) => `${HEADER_COMMENT}\n\n${stringifyHeaders(headers)}`
323+
const transformToString = (headers: any) => `${HEADER_COMMENT}\n\n${stringifyHeaders(headers)}`
309324

310325
const writeHeadersFile =
311-
({ publicFolder }) =>
312-
(contents) =>
313-
writeFile(publicFolder(NETLIFY_HEADERS_FILENAME), contents)
326+
({
327+
publicFolder
328+
}: any) =>
329+
(contents: any) => writeFile(publicFolder(NETLIFY_HEADERS_FILENAME), contents)
314330

315-
const buildHeadersProgram = (pluginData, pluginOptions, reporter) =>
331+
const buildHeadersProgram = (pluginData: any, pluginOptions: any, reporter: any) =>
316332
_.flow(
317333
validateUserOptions(pluginOptions, reporter),
318334
mapUserLinkHeaders(pluginData),
File renamed without changes.

‎src/create-redirects.js renamed to ‎src/create-redirects.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { existsSync, readFile, writeFile } from 'fs-extra'
33
import { HEADER_COMMENT } from './constants'
44

55
// eslint-disable-next-line max-statements
6-
export default async function writeRedirectsFile(pluginData, redirects, rewrites) {
6+
export default async function writeRedirectsFile(pluginData: any, redirects: any, rewrites: any) {
77
const { publicFolder } = pluginData
88

99
if (redirects.length === 0 && rewrites.length === 0) return null
@@ -22,7 +22,7 @@ export default async function writeRedirectsFile(pluginData, redirects, rewrites
2222
])
2323

2424
// Map redirect data to the format Netlify expects
25-
redirects = redirects.map((redirect) => {
25+
redirects = redirects.map((redirect: any) => {
2626
const { fromPath, isPermanent, redirectInBrowser, force, toPath, statusCode, ...rest } = redirect
2727

2828
let status = isPermanent ? `301` : `302`
@@ -49,7 +49,10 @@ export default async function writeRedirectsFile(pluginData, redirects, rewrites
4949
return pieces.join(` `)
5050
})
5151

52-
rewrites = rewrites.map(({ fromPath, toPath }) => `${fromPath} ${toPath} 200`)
52+
rewrites = rewrites.map(({
53+
fromPath,
54+
toPath
55+
}: any) => `${fromPath} ${toPath} 200`)
5356

5457
let commentFound = false
5558

‎src/gatsby-node.js renamed to ‎src/gatsby-node.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ import makePluginData from './plugin-data'
1414
const assetsManifest = {}
1515

1616
/** @type {import("gatsby").GatsbyNode["pluginOptionsSchema"]} */
17-
export const pluginOptionsSchema = ({ Joi }) => {
17+
export const pluginOptionsSchema = ({
18+
Joi
19+
}: any) => {
1820
const MATCH_ALL_KEYS = /^/
1921

2022
// headers is a specific type used by Netlify: https://www.gatsbyjs.com/plugins/gatsby-plugin-netlify/#headers
@@ -42,7 +44,10 @@ export const pluginOptionsSchema = ({ Joi }) => {
4244
// Inject a webpack plugin to get the file manifests so we can translate all link headers
4345
/** @type {import("gatsby").GatsbyNode["onCreateWebpackConfig"]} */
4446

45-
export const onCreateWebpackConfig = ({ actions, stage }) => {
47+
export const onCreateWebpackConfig = ({
48+
actions,
49+
stage
50+
}: any) => {
4651
if (stage !== BUILD_HTML_STAGE && stage !== BUILD_CSS_STAGE) {
4752
return
4853
}
@@ -58,7 +63,11 @@ export const onCreateWebpackConfig = ({ actions, stage }) => {
5863
}
5964

6065
/** @type {import("gatsby").GatsbyNode["onPostBuild"]} */
61-
export const onPostBuild = async ({ store, pathPrefix, reporter }, userPluginOptions) => {
66+
export const onPostBuild = async ({
67+
store,
68+
pathPrefix,
69+
reporter
70+
}: any, userPluginOptions: any) => {
6271
const pluginData = makePluginData(store, assetsManifest, pathPrefix)
6372
const pluginOptions = { ...DEFAULT_OPTIONS, ...userPluginOptions }
6473

@@ -71,7 +80,7 @@ export const onPostBuild = async ({ store, pathPrefix, reporter }, userPluginOpt
7180
reporter.info(`[gatsby-plugin-netlify] Creating SSR/DSG redirects...`)
7281

7382
let count = 0
74-
const rewrites = []
83+
const rewrites: any = []
7584

7685
let needsFunctions = functions.length !== 0
7786

‎src/plugin-data.js renamed to ‎src/plugin-data.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import path from "path"
22

3-
export function buildPrefixer(prefix, ...paths) {
4-
return (...subpaths) => path.join(prefix, ...paths, ...subpaths)
3+
export function buildPrefixer(prefix: any, ...paths: any[]) {
4+
return (...subpaths: any[]) => path.join(prefix, ...paths, ...subpaths);
55
}
66

77
// This function assembles data across the manifests and store to match a similar
88
// shape of `static-entry.js`. With it, we can build headers that point to the correct
99
// hashed filenames and ensure we pull in the componentChunkName.
10-
export default function makePluginData(store, assetsManifest, pathPrefix) {
10+
export default function makePluginData(store: any, assetsManifest: any, pathPrefix: any) {
1111
const { program, pages, components } = store.getState()
1212
const publicFolder = buildPrefixer(program.directory, `public`)
1313
const stats = require(publicFolder(`webpack.stats.json`))

‎tsconfig.json

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
{
2+
"compilerOptions": {
3+
/* Visit https://aka.ms/tsconfig.json to read more about this file */
4+
5+
/* Projects */
6+
// "incremental": true, /* Enable incremental compilation */
7+
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
8+
// "tsBuildInfoFile": "./", /* Specify the folder for .tsbuildinfo incremental compilation files. */
9+
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects */
10+
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
11+
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
12+
13+
/* Language and Environment */
14+
"target": "ES2019", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
15+
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
16+
// "jsx": "preserve", /* Specify what JSX code is generated. */
17+
// "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
18+
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
19+
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h' */
20+
// "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
21+
// "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using `jsx: react-jsx*`.` */
22+
// "reactNamespace": "", /* Specify the object invoked for `createElement`. This only applies when targeting `react` JSX emit. */
23+
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
24+
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
25+
26+
/* Modules */
27+
"module": "commonjs", /* Specify what module code is generated. */
28+
// "rootDir": "./", /* Specify the root folder within your source files. */
29+
// "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
30+
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
31+
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
32+
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
33+
// "typeRoots": [], /* Specify multiple folders that act like `./node_modules/@types`. */
34+
"types": [
35+
"node",
36+
"jest"
37+
], /* Specify type package names to be included without being referenced in a source file. */
38+
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
39+
// "resolveJsonModule": true, /* Enable importing .json files */
40+
// "noResolve": true, /* Disallow `import`s, `require`s or `<reference>`s from expanding the number of files TypeScript should add to a project. */
41+
42+
/* JavaScript Support */
43+
// "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. */
44+
// "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
45+
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from `node_modules`. Only applicable with `allowJs`. */
46+
47+
/* Emit */
48+
// "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
49+
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
50+
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
51+
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
52+
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output. */
53+
"outDir": "./", /* Specify an output folder for all emitted files. */
54+
// "removeComments": true, /* Disable emitting comments. */
55+
// "noEmit": true, /* Disable emitting files from a compilation. */
56+
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
57+
// "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */
58+
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
59+
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
60+
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
61+
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
62+
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
63+
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
64+
// "newLine": "crlf", /* Set the newline character for emitting files. */
65+
// "stripInternal": true, /* Disable emitting declarations that have `@internal` in their JSDoc comments. */
66+
// "noEmitHelpers": true, /* Disable generating custom helper functions like `__extends` in compiled output. */
67+
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
68+
// "preserveConstEnums": true, /* Disable erasing `const enum` declarations in generated code. */
69+
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
70+
// "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
71+
72+
/* Interop Constraints */
73+
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
74+
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
75+
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */
76+
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
77+
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
78+
79+
/* Type Checking */
80+
// "strict": true, /* Enable all strict type-checking options. */
81+
// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied `any` type.. */
82+
// "strictNullChecks": true, /* When type checking, take into account `null` and `undefined`. */
83+
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
84+
// "strictBindCallApply": true, /* Check that the arguments for `bind`, `call`, and `apply` methods match the original function. */
85+
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
86+
// "noImplicitThis": true, /* Enable error reporting when `this` is given the type `any`. */
87+
// "useUnknownInCatchVariables": true, /* Type catch clause variables as 'unknown' instead of 'any'. */
88+
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
89+
// "noUnusedLocals": true, /* Enable error reporting when a local variables aren't read. */
90+
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read */
91+
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
92+
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
93+
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
94+
// "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */
95+
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
96+
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type */
97+
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
98+
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
99+
100+
/* Completeness */
101+
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
102+
"skipLibCheck": true /* Skip type checking all .d.ts files. */
103+
},
104+
"include": ["src/**/*"],
105+
"exclude": ["node_modules/", "src/__tests__"]
106+
}

‎yarn.lock

Lines changed: 230 additions & 387 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)
Please sign in to comment.