Skip to content

Commit

Permalink
Sets "allowSyntheticDefaultImports" to false
Browse files Browse the repository at this point in the history
  • Loading branch information
kettanaito committed Aug 5, 2020
1 parent 25eeeff commit 99d6a3f
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/context/cookie.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import cookieUtils from 'cookie'
import * as cookieUtils from 'cookie'
import { cookie } from './cookie'
import { response } from '../response'

Expand Down
6 changes: 4 additions & 2 deletions src/context/cookie.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import cookieUtils, { CookieSerializeOptions } from 'cookie'
import * as cookieUtils from 'cookie'
import { ResponseTransformer } from '../response'

/**
Expand All @@ -9,14 +9,16 @@ import { ResponseTransformer } from '../response'
export const cookie = (
name: string,
value: string,
options?: CookieSerializeOptions,
options?: cookieUtils.CookieSerializeOptions,
): ResponseTransformer => {
return (res) => {
const serializedCookie = cookieUtils.serialize(name, value, options)
res.headers.set('Set-Cookie', serializedCookie)

if (typeof document !== 'undefined') {
document.cookie = serializedCookie
}

return res
}
}
2 changes: 1 addition & 1 deletion src/context/status.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import statuses from 'statuses/codes.json'
import * as statuses from 'statuses/codes.json'
import { ResponseTransformer } from '../response'

export const status = (
Expand Down
2 changes: 1 addition & 1 deletion src/node/setupServer.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import cookieUtils from 'cookie'
import * as cookieUtils from 'cookie'
import { Headers, flattenHeadersObject } from 'headers-utils'
import {
RequestInterceptor,
Expand Down
2 changes: 1 addition & 1 deletion src/utils/request/getRequestCookies.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import cookieUtils from 'cookie'
import * as cookieUtils from 'cookie'
import { MockedRequest } from '../../handlers/requestHandler'

function getAllCookies() {
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"target": "es6",
"module": "ESNext",
"moduleResolution": "node",
"allowSyntheticDefaultImports": false,
"esModuleInterop": true,
"resolveJsonModule": true,
"declaration": true,
Expand Down

0 comments on commit 99d6a3f

Please sign in to comment.