From 9802a9605480bd131495598744d1d275ee72d026 Mon Sep 17 00:00:00 2001 From: Gary Burgess Date: Thu, 5 Sep 2019 23:50:29 +0100 Subject: [PATCH 1/3] Ensure usages of `unsafeToForeign` are typed --- src/Affjax.purs | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/Affjax.purs b/src/Affjax.purs index 652b6a9..17fefec 100644 --- a/src/Affjax.purs +++ b/src/Affjax.purs @@ -30,6 +30,7 @@ import Data.Argonaut.Core (Json) import Data.Argonaut.Core as J import Data.Argonaut.Parser (jsonParser) import Data.Array as Arr +import Data.ArrayBuffer.Types (ArrayView) import Data.Either (Either(..), either) import Data.Foldable (any) import Data.FormURLEncoded as FormURLEncoded @@ -49,6 +50,9 @@ import Effect.Exception (Error, error) import Effect.Ref as Ref import Foreign (F, Foreign, ForeignError(..), fail, unsafeReadTagged, unsafeToForeign) import Math as Math +import Web.DOM (Document) +import Web.File.Blob (Blob) +import Web.XHR.FormData (FormData) -- | A record that contains all the information to perform an HTTP request. -- | Instead of constructing the record from scratch it is often easier to build @@ -266,13 +270,13 @@ request req = do extractContent :: RequestBody.RequestBody -> Foreign extractContent = case _ of - RequestBody.ArrayView f → f unsafeToForeign - RequestBody.Blob x → unsafeToForeign x - RequestBody.Document x → unsafeToForeign x - RequestBody.String x → unsafeToForeign x - RequestBody.FormData x → unsafeToForeign x - RequestBody.FormURLEncoded x → unsafeToForeign (FormURLEncoded.encode x) - RequestBody.Json x → unsafeToForeign (J.stringify x) + RequestBody.ArrayView f → f (unsafeToForeign :: forall a. ArrayView a -> Foreign) + RequestBody.Blob x → (unsafeToForeign :: Blob -> Foreign) x + RequestBody.Document x → (unsafeToForeign :: Document -> Foreign) x + RequestBody.String x → (unsafeToForeign :: String -> Foreign) x + RequestBody.FormData x → (unsafeToForeign :: FormData -> Foreign) x + RequestBody.FormURLEncoded x → (unsafeToForeign :: String -> Foreign) (FormURLEncoded.encode x) + RequestBody.Json x → (unsafeToForeign :: String -> Foreign) (J.stringify x) headers :: Maybe RequestBody.RequestBody -> Array RequestHeader headers reqContent = From b01cb13af0c33455b9927d433322fa1d5739696b Mon Sep 17 00:00:00 2001 From: Gary Burgess Date: Thu, 5 Sep 2019 23:51:47 +0100 Subject: [PATCH 2/3] Update dependencies --- package.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 618b307..636aabd 100644 --- a/package.json +++ b/package.json @@ -6,13 +6,13 @@ "test": "eslint src && pulp test" }, "devDependencies": { - "eslint": "^3.10.1", - "body-parser": "^1.15.2", - "express": "^4.14.0", - "pulp": "^11.0.0", - "purescript-psa": "^0.5.0", - "purescript": "^0.12.0", - "rimraf": "^2.5.4", - "xhr2": "^0.1.3" + "eslint": "^6.3.0", + "body-parser": "^1.19.0", + "express": "^4.17.1", + "pulp": "^13.0.0", + "purescript-psa": "^0.7.3", + "purescript": "^0.13.3", + "rimraf": "^3.0.0", + "xhr2": "^0.2.0" } } From 474818b73ec029b5658e5c0d970efeb1e3b22000 Mon Sep 17 00:00:00 2001 From: Gary Burgess Date: Thu, 5 Sep 2019 23:53:40 +0100 Subject: [PATCH 3/3] Remove unnecessary eslint global directives --- src/Affjax.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Affjax.js b/src/Affjax.js index cd68a6a..d2c1da0 100644 --- a/src/Affjax.js +++ b/src/Affjax.js @@ -1,6 +1,4 @@ -/* global exports */ /* global XMLHttpRequest */ -/* global module */ /* global process */ "use strict";