Skip to content

Instantly share code, notes, and snippets.

@j1n3l0
Last active July 10, 2020 11:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save j1n3l0/2ab08538c480803be00253f4521607be to your computer and use it in GitHub Desktop.
Save j1n3l0/2ab08538c480803be00253f4521607be to your computer and use it in GitHub Desktop.
A simple type library demonstrating Dict with optional arguments
package Foo;
use Type::Library -base;
use Type::Utils qw( as declare );
use Types::Standard qw( Dict HashRef Int slurpy );
declare Params, as Dict[ id => Int, slurpy HashRef ];
1;
use Test2::V0;
use Foo qw( is_Params );
ok( is_Params({ id => 1 }), 'should be a valid Params' );
ok( is_Params({ id => 1, code => 2 }), 'should be a valid Params' );
done_testing();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment