Skip to content

Commit

Permalink
test(integration): verify typed usage
Browse files Browse the repository at this point in the history
  • Loading branch information
nikku committed Feb 4, 2024
1 parent 8ee9a19 commit 641b629
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/integration/ts.spec.ts
Expand Up @@ -90,6 +90,9 @@ describe('typed', function() {
// we still accept it
const boolBar = injector.get<boolean>('bar');
expect(boolBar).to.exist;

// @ts-expect-error illegal type conversion
const invalidFoo : string = injector.get('foo');
});

});
Expand Down Expand Up @@ -127,6 +130,7 @@ describe('typed', function() {
const bub = injector.get<BubType>('bub');
const baz = injector.get('baz') as BazType;

const typedFoo : string = injector.get('foo');
const maybeBar = injector.get<string>('bar', false);

// then
Expand All @@ -135,6 +139,7 @@ describe('typed', function() {
expect(foop).to.eql('bar-value');

expect(maybeBar!.charAt(0)).to.eql('b');
expect(typedFoo).to.eql('foo-value');

expect(bub).to.be.an.instanceof(BubType);
expect(bub.bar).to.eql('bar-value');
Expand Down

0 comments on commit 641b629

Please sign in to comment.