Skip to content

Commit 663e886

Browse files
committed
test: add test for route model binding and interfaces
1 parent 0b3b521 commit 663e886

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

tests/js/route.test-d.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,13 @@ assertType(route('posts.comments.show', { post: { foo: 'bar' } }));
4141
// Binding/'routable' object example with custom 'uuid' binding
4242
assertType(route('posts.comments.show', { comment: { uuid: 1 }, post: '1' }));
4343
// Allows extra nested object properties
44+
interface Test {
45+
uuid: number;
46+
foo: string;
47+
}
48+
49+
const comment: Test = { uuid: 1, foo: 'bar' };
50+
assertType(route('posts.comments.show', { comment, post: '1' }));
4451
assertType(route('posts.comments.show', { comment: { uuid: 1, foo: 'bar' }, post: '1' }));
4552
// @ts-expect-error missing 'uuid' key in comment parameter object
4653
assertType(route('posts.comments.show', { comment: { foo: 'bar' } }));

0 commit comments

Comments
 (0)