nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: Hopding/pdf-lib
Pull request #458 (2020-05-24 17:09:28)

Cap parsed numbers at Number.MAX_SAFE_INTEGER


Patch:
diff --git a/src/core/parser/BaseParser.ts b/src/core/parser/BaseParser.ts
index f12f817..2b88c5d 100644
--- a/src/core/parser/BaseParser.ts
+++ b/src/core/parser/BaseParser.ts
@@ -59,6 +59,12 @@ class BaseParser {
       throw new NumberParsingError(this.bytes.position(), value);
     }
 
+    if (numberValue > Number.MAX_SAFE_INTEGER) {
+      const msg = `Parsed number that is too large for some PDF readers: ${value}, using Number.MAX_SAFE_INTEGER instead.`;
+      console.warn(msg);
+      return Number.MAX_SAFE_INTEGER;
+    }
+
     return numberValue;
   }
 


Test patch:
diff --git a/tests/core/parser/PDFObjectParser.spec.ts b/tests/core/parser/PDFObjectParser.spec.ts
index 9bc117f..f91aadc 100644
--- a/tests/core/parser/PDFObjectParser.spec.ts
+++ b/tests/core/parser/PDFObjectParser.spec.ts
@@ -16,6 +16,7 @@ import {
   PDFRef,
   PDFString,
   typedArrayFor,
+  numberToString,
 } from 'src/index';
 
 const parse = (value: string | Uint8Array) => {
@@ -30,6 +31,28 @@ const expectParseStr = (value: string | Uint8Array) =>
   expect(String(parse(value)));
 
 describe(`PDFObjectParser`, () => {
+  const origConsoleWarn = console.warn;
+
+  beforeAll(() => {
+    console.warn = jest.fn((...args) => {
+      if (
+        !args[0].includes(
+          'Parsed number that is too large for some PDF readers:',
+        )
+      ) {
+        origConsoleWarn(...args);
+      }
+    });
+  });
+
+  beforeEach(() => {
+    jest.clearAllMocks();
+  });
+
+  afterAll(() => {
+    console.warn = origConsoleWarn;
+  });
+
   it(`throws an error when given empty input`, () => {
     expect(() => parse('')).toThrow();
   });
@@ -130,6 +153,24 @@ describe(`PDFObjectParser`, () => {
       expect(parser.parseObject().toString()).toBe('-2');
       expect(parser.parseObject().toString()).toBe('-0.1');
     });
+
+    it(`caps numbers at Number.MAX_SAFE_INTEGER`, () => {
+      expectParseStr(numberToString(Number.MAX_SAFE_INTEGER - 1)).toBe(
+        '9007199254740990',
+      );
+      expectParseStr(numberToString(Number.MAX_SAFE_INTEGER)).toBe(
+        '9007199254740991',
+      );
+      expectParseStr(numberToString(Number.MAX_SAFE_INTEGER + 1)).toBe(
+        '9007199254740991',
+      );
+      expectParseStr('340282346638528900000000000000000000000').toBe(
+        '9007199254740991',
+      );
+      expectParseStr('340282346638528859811704183484516925440').toBe(
+        '9007199254740991',
+      );
+    });
   });
 
   describe(`when parsing literal strings`, () => {
Repository: Hopding/pdf-lib
Pull request #496 (2020-06-20 14:24:26)

Remove indirect objects with objectNumber=0 after parsing


Patch:
diff --git a/src/core/parser/PDFParser.ts b/src/core/parser/PDFParser.ts
index 6e2cc53..5b5497e 100644
--- a/src/core/parser/PDFParser.ts
+++ b/src/core/parser/PDFParser.ts
@@ -69,6 +69,11 @@ class PDFParser extends PDFObjectParser {
 
     this.maybeRecoverRoot();
 
+    if (this.context.lookup(PDFRef.of(0))) {
+      console.warn('Removing parsed object: 0 0 R');
+      this.context.delete(PDFRef.of(0));
+    }
+
     return this.context;
   }
 


Test patch:
diff --git a/tests/core/parser/PDFParser.spec.ts b/tests/core/parser/PDFParser.spec.ts
index b53565b..f43167a 100644
--- a/tests/core/parser/PDFParser.spec.ts
+++ b/tests/core/parser/PDFParser.spec.ts
@@ -21,7 +21,8 @@ describe(`PDFParser`, () => {
     console.warn = jest.fn((...args) => {
       if (
         !args[0].includes('Trying to parse invalid object:') &&
-        !args[0].includes('Invalid object ref:')
+        !args[0].includes('Invalid object ref:') &&
+        !args[0].includes('Removing parsed object: 0 0 R')
       ) {
         origConsoleWarn(...args);
       }
@@ -368,4 +369,30 @@ describe(`PDFParser`, () => {
     const object28 = context.lookup(PDFRef.of(28));
     expect(object28).toBeInstanceOf(PDFDict);
   });
+
+  it(`removes indirect objects with objectNumber=0`, async () => {
+    const input = `
+    %PDF-1.7
+    1 0 obj
+      (foo)
+    endobj
+    0 0 obj
+      (bar)
+    endobj
+    2 0 obj
+      (baz)
+    endobj
+    %%EOF
+  `;
+    const parser = PDFParser.forBytesWithOptions(typedArrayFor(input));
+    const context = await parser.parseDocument();
+
+    expect(context.enumerateIndirectObjects().length).toBe(2);
+    const object1 = context.lookup(PDFRef.of(1));
+    expect(object1).toBeInstanceOf(PDFString);
+    const object0 = context.lookup(PDFRef.of(0));
+    expect(object0).toBe(undefined);
+    const object2 = context.lookup(PDFRef.of(2));
+    expect(object2).toBeInstanceOf(PDFString);
+  });
 });
Repository: auth0/auth0-python
Pull request #495 (2023-05-25 07:47:24)

Fix update_template_universal_login
Fixes https://github.com/auth0/auth0-python/issues/494


Patch:
diff --git a/auth0/management/branding.py b/auth0/management/branding.py
index 7d60cc5..1a65c9e 100644
--- a/auth0/management/branding.py
+++ b/auth0/management/branding.py
@@ -91,7 +91,7 @@ class Branding:
 
         return self.client.put(
             self._url("templates", "universal-login"),
-            body={"template": body},
+            data={"template": body},
         )
 
     def get_default_branding_theme(self):


Test patch:
diff --git a/auth0/test/management/test_branding.py b/auth0/test/management/test_branding.py
index a10bf3b..fd2c858 100644
--- a/auth0/test/management/test_branding.py
+++ b/auth0/test/management/test_branding.py
@@ -59,17 +59,19 @@ class TestBranding(unittest.TestCase):
             "https://domain/api/v2/branding/templates/universal-login",
         )
 
-    @mock.patch("auth0.management.branding.RestClient")
+    @mock.patch("auth0.rest.requests.put")
     def test_update_template_universal_login(self, mock_rc):
-        api = mock_rc.return_value
-        api.put.return_value = {}
+        mock_rc.return_value.status_code = 200
+        mock_rc.return_value.text = "{}"
 
         branding = Branding(domain="domain", token="jwttoken")
         branding.update_template_universal_login({"a": "b", "c": "d"})
 
-        api.put.assert_called_with(
+        mock_rc.assert_called_with(
             "https://domain/api/v2/branding/templates/universal-login",
-            body={"template": {"a": "b", "c": "d"}},
+            json={"template": {"a": "b", "c": "d"}},
+            headers=mock.ANY,
+            timeout=5.0,
         )
 
     @mock.patch("auth0.management.branding.RestClient")
Repository: auth0/auth0-python
Pull request #539 (2023-10-23 16:53:26)

Authentication API, the Database classs, Add the organization param to the change_password method
### Changes

Authentication API, the Database class, added the `organization` param to the `change_password` method.

### References

https://auth0.com/docs/api/authentication#change-password

### Testing

- [x] This change adds unit test coverage

### Checklist

- [x] I have read the [Auth0 general contribution guidelines](https://github.com/auth0/open-source-template/blob/master/GENERAL-CONTRIBUTING.md)
- [x] I have read the [Auth0 Code of Conduct](https://github.com/auth0/open-source-template/blob/master/CODE-OF-CONDUCT.md)
- [x] All existing and new tests complete without errors



Patch:
diff --git a/auth0/authentication/database.py b/auth0/authentication/database.py
index 9bfd614..17f6322 100644
--- a/auth0/authentication/database.py
+++ b/auth0/authentication/database.py
@@ -79,19 +79,27 @@ class Database(AuthenticationBase):
         return data
 
     def change_password(
-        self, email: str, connection: str, password: str | None = None
+        self,
+        email: str,
+        connection: str,
+        password: str | None = None,
+        organization: str | None = None,
     ) -> str:
         """Asks to change a password for a given user.
 
         email (str): The user's email address.
 
         connection (str): The name of the database connection where this user should be created.
+
+        organization (str, optional): The id of the Organization associated with the user.
         """
         body = {
             "client_id": self.client_id,
             "email": email,
             "connection": connection,
         }
+        if organization:
+            body["organization"] = organization
 
         data: str = self.post(
             f"{self.protocol}://{self.domain}/dbconnections/change_password",


Test patch:
diff --git a/auth0/test/authentication/test_database.py b/auth0/test/authentication/test_database.py
index b7f1d98..1572e1a 100644
--- a/auth0/test/authentication/test_database.py
+++ b/auth0/test/authentication/test_database.py
@@ -78,3 +78,25 @@ class TestDatabase(unittest.TestCase):
                 "connection": "conn",
             },
         )
+
+    @mock.patch("auth0.rest.RestClient.post")
+    def test_change_password_with_organization_param(self, mock_post):
+        d = Database("my.domain.com", "cid")
+
+        # ignores the password argument
+        d.change_password(
+            email="a@b.com", password="pswd", connection="conn", organization="org_id"
+        )
+
+        args, kwargs = mock_post.call_args
+
+        self.assertEqual(args[0], "https://my.domain.com/dbconnections/change_password")
+        self.assertEqual(
+            kwargs["data"],
+            {
+                "client_id": "cid",
+                "email": "a@b.com",
+                "connection": "conn",
+                "organization": "org_id",
+            },
+        )
Repository: getsentry/sentry-capacitor
Pull request #584 (2024-02-28 09:28:02)

fix: disable native sdk if DSN is not provided
When no DSN is provided, the `initNativeSdk` function returns before the `enableNative` option is set. Effectively rendering the option useless.

This causes, the native sdk to still perform the checks of whether the native client is available and if that is not the case, then throws the `NativeClientError`.

A simple reproduction example would be:

```typescript
Sentry.init({
  dsn: undefined,
  enableNative: false,
});

setUser(null);
```

the `setUser` call will throw the NativeClientError.

I chose to set `enableNative` to false regardless of the provided option since the warning message that gets logged when the DSN is not provided states "... Native SDK will also not be initialized.", which should be enough of a hint that the native sdk will not function regardless of the provided `enableNative` unless a DSN is provided.

Floppy012: Rebased & Fixed conflicts

Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index adf145e..9afb2fd 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,11 @@
 # Changelog
 
+## Unreleased
+
+### Fixes
+
+- Native integration would not properly disable when no DSN was provided ([#584](https://github.com/getsentry/sentry-capacitor/pull/584))
+
 ## 0.16.0
 
 ### Features
diff --git a/src/wrapper.ts b/src/wrapper.ts
index ae3712c..3225eaf 100644
--- a/src/wrapper.ts
+++ b/src/wrapper.ts
@@ -82,6 +82,8 @@ export const NATIVE = {
       logger.warn(
         'Warning: No DSN was provided. The Sentry SDK will be disabled. Native SDK will also not be initalized.',
       );
+
+      this.enableNative = false;
       return false;
     }
 


Test patch:
diff --git a/test/wrapper.test.ts b/test/wrapper.test.ts
index a056df7..26c1fca 100644
--- a/test/wrapper.test.ts
+++ b/test/wrapper.test.ts
@@ -163,6 +163,14 @@ describe('Tests Native Wrapper', () => {
         'Note: Native Sentry SDK is disabled.',
       );
     });
+
+    test('sets enableNative: false when dsn is undefined', async () => {
+      await NATIVE.initNativeSdk({
+        dsn: undefined,
+      });
+
+      expect(NATIVE.enableNative).toBe(false);
+    });
   });
 
   describe('sendEnvelope', () => {
Repository: gcanti/io-ts
Pull request #436 (2020-04-03 06:46:48)

fix regression in v2.1.2


Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4806bfc..d520e58 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -14,7 +14,7 @@
 **Note**: Gaps between patch versions are faulty/broken releases. **Note**: A feature tagged as Experimental is in a
 high state of flux, you're at risk of it changing without notice.
 
-# 2.1.2
+# 2.1.3
 
 - **Polish**
   - remove useless `hasOwnProperty` calls, closes #423 (@gcanti)
diff --git a/package.json b/package.json
index 89b8b39..6860f38 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "io-ts",
-  "version": "2.1.2",
+  "version": "2.1.3",
   "description": "TypeScript compatible runtime type system for IO validation",
   "files": [
     "lib",
diff --git a/src/index.ts b/src/index.ts
index 2f17b9e..8757094 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -798,7 +798,8 @@ export const type = <P extends Props>(props: P, name: string = getInterfaceTypeN
       if (UnknownRecord.is(u)) {
         for (let i = 0; i < len; i++) {
           const k = keys[i]
-          if (!types[i].is(u[k])) {
+          const uk = u[k]
+          if ((uk === undefined && !hasOwnProperty.call(u, k)) || !types[i].is(uk)) {
             return false
           }
         }


Test patch:
diff --git a/test/type.ts b/test/type.ts
index 3666391..fe06b5b 100644
--- a/test/type.ts
+++ b/test/type.ts
@@ -31,6 +31,12 @@ describe('type', () => {
       assert.strictEqual(T.is([]), false)
     })
 
+    // #434
+    it('should return `false` on missing fields', () => {
+      const T = t.type({ a: t.unknown })
+      assert.strictEqual(T.is({}), false)
+    })
+
     it('should allow additional properties', () => {
       const T = t.type({ a: t.string })
       assert.strictEqual(T.is({ a: 'a', b: 1 }), true)
Repository: gcanti/io-ts
Pull request #520 (2020-10-03 16:31:29)

Make toForest stack-safe
Without this change on big input with many errors toForest throws stack overflow.

<img width="349" alt="Screen Shot 2020-10-03 at 8 40 50 PM" src="https://user-images.githubusercontent.com/1932383/94997117-294e8600-05ba-11eb-9b33-74118cc0474c.png">




---


I've added very simple test for FreeSemigroup because of this:
<img width="425" alt="Screen Shot 2020-10-03 at 8 48 44 PM" src="https://user-images.githubusercontent.com/1932383/94997139-57cc6100-05ba-11eb-9e52-e7a289fdeded.png">



Patch:
diff --git a/src/Decoder.ts b/src/Decoder.ts
index 51d97db..a44f78e 100644
--- a/src/Decoder.ts
+++ b/src/Decoder.ts
@@ -549,10 +549,27 @@ const toTree: (e: DE.DecodeError<string>) => Tree<string> = DE.fold({
   Wrap: (error, errors) => make(error, toForest(errors))
 })
 
-const toForest: (e: DecodeError) => ReadonlyArray<Tree<string>> = FS.fold(
-  (value) => [toTree(value)],
-  (left, right) => toForest(left).concat(toForest(right))
-)
+const toForest = (e: DecodeError): ReadonlyArray<Tree<string>> => {
+  const stack = []
+  let focus = e
+  const res = []
+  while (true) {
+    switch (focus._tag) {
+      case 'Of':
+        res.push(toTree(focus.value))
+        if (stack.length === 0) {
+          return res
+        } else {
+          focus = stack.pop()!
+        }
+        break
+      case 'Concat':
+        stack.push(focus.right)
+        focus = focus.left
+        break
+    }
+  }
+}
 
 /**
  * @since 2.2.7


Test patch:
diff --git a/test/Decoder.ts b/test/Decoder.ts
index 0be76e0..c23f6db 100644
--- a/test/Decoder.ts
+++ b/test/Decoder.ts
@@ -534,6 +534,22 @@ describe('Decoder', () => {
   // -------------------------------------------------------------------------------------
 
   describe('draw', () => {
+    it('is stack safe', () => {
+      expect(() => {
+        E.mapLeft(_.draw)(
+          _.record(_.type({ done: _.boolean })).decode(
+            new Array(10000)
+              .fill({})
+              .map((v, k) => [k, v])
+              .reduce((acc, [k, v]) => {
+                acc[k] = v
+                return acc
+              }, {} as Record<string, unknown>)
+          )
+        )
+      }).not.toThrow()
+    })
+
     it('draw', () => {
       const decoder = _.type({
         a: _.string,
diff --git a/test/FreeSemigroup.ts b/test/FreeSemigroup.ts
new file mode 100644
index 0000000..029dcb7
--- /dev/null
+++ b/test/FreeSemigroup.ts
@@ -0,0 +1,13 @@
+import * as FS from '../src/FreeSemigroup'
+
+describe('FreeSemigroup', () => {
+  it('fold', () => {
+    const sum: (input: FS.FreeSemigroup<string>) => string = FS.fold(
+      (value) => value,
+      (left, right) => sum(left) + sum(right)
+    )
+
+    expect(sum(FS.of('1'))).toBe('1')
+    expect(sum(FS.concat(FS.of('1'), FS.of('2')))).toBe('12')
+  })
+})
Repository: gcanti/io-ts-types
Pull request #48 (2018-08-03 11:59:29)

UUID type added
Really common datatype when working with databases.

gcanti: how do you feel about moving `UUID.ts` to a `string` folder?
mlegenhausen: Sure!
mlegenhausen: Done
gcanti: Looks like travis is failing due to https://github.com/facebook/jest/issues/6766
We could try this fix https://github.com/facebook/jest/issues/6766#issuecomment-408381957

mlegenhausen: Jest fix added.

Patch:
diff --git a/README.md b/README.md
index 3cebfac..3dff0cc 100644
--- a/README.md
+++ b/README.md
@@ -264,3 +264,13 @@ import { NumberFromString } from 'io-ts-types/lib/number/NumberFromString'
 NumberFromString.decode('1') // right(1)
 NumberFromString.decode('1.1') // right(1.1)
 ```
+
+## string
+
+### `uuid`
+
+```ts
+import { uuid } from 'io-ts-types/lib/string/uuid'
+
+uuid.decode('6e9c5587-a342-4b63-a901-87b31fa2ffa3') // right('6e9c5587-a342-4b63-a901-87b31fa2ffa3')
+```
diff --git a/package.json b/package.json
index 0ae5d29..945f1cb 100644
--- a/package.json
+++ b/package.json
@@ -70,6 +70,7 @@
     "moduleFileExtensions": [
       "ts",
       "js"
-    ]
+    ],
+    "testEnvironment": "node"
   }
 }
diff --git a/src/index.ts b/src/index.ts
index 5200cc7..bb0c63d 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -32,3 +32,6 @@ export { NumberFromString } from './number/NumberFromString'
 
 // top level
 export { mapOutput } from './mapOutput'
+
+// UUID
+export { uuid } from './string/uuid'
diff --git a/src/string/uuid.ts b/src/string/uuid.ts
new file mode 100644
index 0000000..89636ee
--- /dev/null
+++ b/src/string/uuid.ts
@@ -0,0 +1,5 @@
+import * as t from 'io-ts'
+
+const regex = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i
+
+export const uuid = t.refinement(t.string, uuid => regex.test(uuid), 'UUID')


Test patch:
diff --git a/test/index.ts b/test/index.ts
index dc0e5ed..5abe3cc 100644
--- a/test/index.ts
+++ b/test/index.ts
@@ -23,7 +23,8 @@ import {
   lensesFromProps,
   lensesFromInterface,
   mapOutput,
-  fromNewtypeCurried
+  fromNewtypeCurried,
+  uuid
 } from '../src'
 import { left, right } from 'fp-ts/lib/Either'
 import { none, some } from 'fp-ts/lib/Option'
@@ -321,3 +322,8 @@ describe('JSON', () => {
     assert.deepEqual(T.decode('{"name":"Giulio"}'), right({ name: 'Giulio' }))
   })
 })
+
+it('UUID', () => {
+  assert.deepEqual(uuid.decode('6e9c5587-a342-4b63-a901-87b31fa2ffa3'), right('6e9c5587-a342-4b63-a901-87b31fa2ffa3'))
+  assert.deepEqual(PathReporter.report(uuid.decode('invalid')), ['Invalid value "invalid" supplied to : UUID'])
+})
Repository: gcanti/io-ts-types
Pull request #53 (2018-08-09 23:16:29)

add fromNullable fixe #51

gcanti: @sledorze there's a conflict. btw do you want me to release 0.3.10 after merging this?
sledorze: @gcanti Yes a release would be appreciated!


Patch:
diff --git a/src/fromNullable.ts b/src/fromNullable.ts
new file mode 100644
index 0000000..0fe68e5
--- /dev/null
+++ b/src/fromNullable.ts
@@ -0,0 +1,7 @@
+import * as t from 'io-ts'
+
+export const fromNullable = <A, O, I>(type: t.Type<A, O, I>) => (
+  a: A,
+  name: string = `fromNullable(${type.name})`
+): t.Type<A, O, I | undefined | null> =>
+  new t.Type(name, type.is, (i, context) => (i == null ? t.success(a) : type.validate(i, context)), type.encode)
diff --git a/src/index.ts b/src/index.ts
index d3ec88e..8982a46 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -10,6 +10,7 @@ export { createOptionFromJSON } from './fp-ts/createOptionFromJSON'
 export { createOptionFromNullable } from './fp-ts/createOptionFromNullable'
 export { createSetFromArray } from './fp-ts/createSetFromArray'
 export { createStrMapFromDictionary } from './fp-ts/createStrMapFromDictionary'
+export { fromNullable } from './fromNullable'
 
 // JSON
 export { JSONFromString, JSONType } from './JSON/JSONFromString'


Test patch:
diff --git a/test/index.ts b/test/index.ts
index c2b261c..5051e37 100644
--- a/test/index.ts
+++ b/test/index.ts
@@ -25,6 +25,7 @@ import {
   mapOutput,
   fromNewtypeCurried,
   uuid,
+  fromNullable,
   fallback
 } from '../src'
 import { left, right } from 'fp-ts/lib/Either'
@@ -161,6 +162,14 @@ describe('fp-ts', () => {
     assert.strictEqual(T.is(new StrMap({ foo: 'not a number' })), false)
     assert.strictEqual(T.is('not a strmap'), false)
   })
+
+  it('fromNullable', () => {
+    const T = fromNullable(t.number)(0)
+    assert.deepEqual(T.decode(42), right(42))
+    assert.deepEqual(T.decode(null), right(0))
+    assert.deepEqual(T.decode(undefined), right(0))
+    assert.deepEqual(T.decode({}).isLeft(), true)
+  })
 })
 
 describe('number', () => {
Repository: gcanti/io-ts-types
Pull request #123 (2020-02-21 13:17:41)

fromNewtype non primitive type support added
Without this change it not possible to use any type where the `A` is unequal to the `O` of `Type<A, O>`. I had the problem when using `Int` from `io-ts` as codec.

I added a test to prevent regression.


Patch:
diff --git a/docs/modules/fromNewtype.ts.md b/docs/modules/fromNewtype.ts.md
index 314a6c9..153593b 100644
--- a/docs/modules/fromNewtype.ts.md
+++ b/docs/modules/fromNewtype.ts.md
@@ -24,7 +24,7 @@ Returns a codec from a newtype
 
 ```ts
 export function fromNewtype<N extends AnyNewtype = never>(
-  codec: t.Type<CarrierOf<N>>,
+  codec: t.Type<CarrierOf<N>, t.OutputOf<CarrierOf<N>>>,
   name = `fromNewtype(${codec.name})`
 ): t.Type<N, CarrierOf<N>, unknown> { ... }
 ```
diff --git a/src/fromNewtype.ts b/src/fromNewtype.ts
index 6eedc80..ad7ba23 100644
--- a/src/fromNewtype.ts
+++ b/src/fromNewtype.ts
@@ -25,7 +25,7 @@ import { either } from 'fp-ts/lib/Either'
  * @since 0.5.2
  */
 export function fromNewtype<N extends AnyNewtype = never>(
-  codec: t.Type<CarrierOf<N>>,
+  codec: t.Type<CarrierOf<N>, t.OutputOf<CarrierOf<N>>>,
   name = `fromNewtype(${codec.name})`
 ): t.Type<N, CarrierOf<N>, unknown> {
   const i = iso<N>()


Test patch:
diff --git a/test/fromNewtype.ts b/test/fromNewtype.ts
index 699b02a..4a71b40 100644
--- a/test/fromNewtype.ts
+++ b/test/fromNewtype.ts
@@ -12,6 +12,15 @@ it('fromNewtype', () => {
   assertFailure(T, 42, ['Invalid value 42 supplied to : fromNewtype(string)'])
   assert.ok(T.is('sometoken'))
   assert.deepStrictEqual(T.encode(token), 'sometoken')
+
   const T2 = fromNewtype<Token>(t.string, 'T2')
   assert.strictEqual(T2.name, 'T2')
+
+  interface Id extends Newtype<{ readonly Id: unique symbol }, t.Int> {}
+  const T3 = fromNewtype<Id>(t.Int)
+  const id = iso<Id>().wrap(123 as any)
+  assertSuccess(T3.decode(123), id)
+  assertFailure(T3, 'test', ['Invalid value "test" supplied to : fromNewtype(Int)'])
+  assert.ok(T3.is(123))
+  assert.deepStrictEqual(T3.encode(id), 123)
 })