-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #129 from andnp/Fix-Intersections
Fix intersections
- Loading branch information
Showing
5 changed files
with
117 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
set -e | ||
|
||
for v in 3.0.3 3.1.6 3.2.2 next; do | ||
# highest patch version of each minor version | ||
for v in 3.0.3 3.1.6 3.2.4 3.3.4000 3.4.5 3.5.3 3.6.5 3.7.5 3.8.3 next; do | ||
npm install --no-save typescript@$v | ||
npm test | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import test from 'ava'; | ||
import { assert } from '../helpers/assert'; | ||
|
||
import { ElementwiseIntersect } from '../../src'; | ||
|
||
test('Can combine two objects elementwise', t => { | ||
type a = { x: number, y: 'hi' }; | ||
type b = { z: number, y: 'there' }; | ||
|
||
type got = ElementwiseIntersect<a, b>; | ||
type expected = { | ||
x: number, | ||
y: 'hi' & 'there', | ||
z: number, | ||
}; | ||
|
||
assert<got, expected>(t); | ||
assert<expected, got>(t); | ||
}); | ||
|
||
test('Can combine two objects with private members elementwise', t => { | ||
class A { | ||
a: number = 1; | ||
private x: number = 2; | ||
y: 'hi' = 'hi'; | ||
private z: 'hey' = 'hey'; | ||
} | ||
|
||
class B { | ||
a: 22 = 22; | ||
private x: number = 2; | ||
y: 'there' = 'there'; | ||
private z: 'friend' = 'friend'; | ||
} | ||
|
||
type got = ElementwiseIntersect<A, B>; | ||
type expected = { | ||
a: 22, | ||
y: 'hi' & 'there', | ||
}; | ||
|
||
assert<got, expected>(t); | ||
assert<expected, got>(t); | ||
}); |