Skip to content

Commit

Permalink
Merge pull request #660 from jan-molak/fix/es2021
Browse files Browse the repository at this point in the history
feat(tiny-types): transpile tiny-types to es2021
  • Loading branch information
jan-molak authored Jul 7, 2023
2 parents 25a1bb1 + 895f4d7 commit 96e3a47
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 46 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:

strategy:
matrix:
node-version: [ 14.x, 16.x, 18.x ]
node-version: [ 16.x, 18.x, 20.x ]

steps:
- uses: actions/checkout@v3
Expand Down
33 changes: 0 additions & 33 deletions spec/objects/deprecated.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,39 +110,6 @@ describe('deprecated', () => {
});
});

describe('when used to deprecate a function', () => {
it('logs a warning when the function is used', () => {
const consoleWarn = sinon.spy();

// eslint-disable-next-line unicorn/consistent-function-scoping
function foo() {
return null;
}

const deprecatedFoo = deprecated('Please use bar instead.', consoleWarn)(foo);

deprecatedFoo();

expect(consoleWarn)
.to.have.been.calledWith('foo has been deprecated. Please use bar instead.');

});

it('logs a warning when an arrow function is used', () => {
const consoleWarn = sinon.spy();

// eslint-disable-next-line unicorn/consistent-function-scoping
const foo = () => null;

const deprecatedFoo = deprecated('Please use bar instead.', consoleWarn)(foo);

deprecatedFoo();

expect(consoleWarn)
.to.have.been.calledWith('foo has been deprecated. Please use bar instead.');
});
});

describe('when used incorrectly', () => {

it('complains', () => {
Expand Down
7 changes: 0 additions & 7 deletions spec/predicates/isPlainObject.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,6 @@ describe('predicates', () => {
expect(() => ensure('value', value, isPlainObject())).to.throw(`value should be a plain object`);
});

it('complains if the value is not a plain object because of a modified constructor prototype', () => {
const value = new Person('Cindy');
(value as any).constructor.prototype = undefined;

expect(() => ensure('value', value, isPlainObject())).to.throw(`value should be a plain object`);
});

it('is generic', () => {
interface Person {
name: string;
Expand Down
4 changes: 2 additions & 2 deletions src/predicates/property.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ class HaveProperty<T, K extends keyof T> extends Predicate<T> {

return result instanceof Failure
? new Failure(value, `have a property "${ String(this.propertyName) }" that ${ result.description }`
.replace(/\bbe\b/gi, 'is')
.replace(/\beither is\b/gi, 'is either'),
.replaceAll(/\bbe\b/gi, 'is')
.replaceAll(/\beither is\b/gi, 'is either'),
)
: new Success(value);
}
Expand Down
6 changes: 3 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"compilerOptions": {
"target": "es5",
"lib": [ "es5", "es6" ],
"target": "es2021",
"lib": [ "es2021" ],
"module": "commonjs",
"sourceMap": true,
"declaration": true,
Expand All @@ -19,4 +19,4 @@
"exclude": [
"node_modules"
]
}
}

0 comments on commit 96e3a47

Please sign in to comment.