►
Description
No description was provided for this meeting.
If this is YOUR meeting, an easy way to fix this is to add a description to your video, wherever mtngs.io found it (probably YouTube).
A
Hello,
open
jeaious
world,
my
name
is
Ethan
Arrowwood
and
welcome
to
my
talk
on
applying
advanced
typescript
definition
patterns.
I'm,
a
software
engineer
at
Microsoft
and
my
pronouns
are
he/him.
If
you'd
like
to
follow
me
on
Twitter
github,
you
can
find
me
under
those
handles,
so
today's
talk
is
going
to
be
about
pacify
and
its
new
type
definitions.
A
Pacify
is
a
nodejs
web
server
framework.
We
are
part
of
the
open,
J's
foundation
and
we
are
open
sourced
today
we're
going
to
be
covering
five
patterns,
but
we're
going
to
be
doing
so
in
three
parts,
so
the
first
part
is
going
to
be
covering
discriminant
unions
and
function
overloading.
The
second
part
is
gonna
cover
name
generic
parameters
and
the
third
part
is
going
to
cover
declaration
merging
and
generic
inference.
A
We're
gonna
be
doing
this
through
a
sort
of
a
code.
Walkthrough
we're
gonna,
be
building
these
type
patterns
from
scratch.
Over
a
simplified
implementation
of
FASTA
file,
you
can
check
out
the
source
code
on
github
I'll
have
a
master
branch
which
will
have
all
the
completed
code
as
well
as
an
initial
branch.
That'll
have
the
you
know
where
you
know
the
starting
point
if
you'd
like
to
follow
along
as
well.
A
Alright
and
welcome
to
the
coding
portion
with
my
presentation,
as
I
mentioned
before,
there's
going
to
be
three
parts.
The
first
one
is
going
to
be
handling
discriminating
unions
and
function.
Overloading
the
goal
will
be
to
implement
the
types
that
will
help
define
the
right
options,
objects
to
determine
which
node
server
should
be
returned
when
calling
in
the
fastest
by
function.
Part
two
is
gonna,
handle
a
named
generic
parameter,
and
this
is
going
to
be
all
about
how
we
decorate
the
request.
A
Object
with
you,
know,
four
different
properties
and
only
have
to
specify
the
ones
that
the
user
expects
to
be
passed
to
the
request,
object
and,
finally,
for
part
three
we're
going
to
be
covering
declaration
merging.
In
this
case,
we
have
two
methods
of
modifying
the
local,
the
local
instance
where
this
server
this
pacify
server
you
can
decorate
with
you
know
unique
values.
You
can
also
provide
plugins
that
have
access
to
that
instance
and
can
also
do
things
like
decorate
the
instance
with
custom
properties.
A
So
we're
going
to
use
declaration
merging
to
implement
a
plug-in
system
of
sorts
we'll.
Do
it
we'll
take
a
quick
peek
at
the
types?
So
this
is
going
to
be
our
goal.
Today
is
going
to
be
converting
all
the
types
to
see
what
you
see
here,
but
we're
going
to
do
it,
we're
gonna,
take
it
line
by
line
and
explain
as
we
go
and
we're
gonna
start
here
with
the
initial
fast
if
I
type
file,
so
you
can
see
that
the
func
the
function
down
here
takes
in
an
options
object.
A
That
has
you
know
three
optional
properties
and
it
returns
a
fast
if
I
instance,
this
fast
I
instance,
has
a
single
property
server
that
returns.
You
know
one
of
the
four
nodejs
server
types
we
can
take
a
quick
peek
at
our
implementation,
and
you
can
see
that
the
goal
here
you
know
using
that
final
type
doc.
We
can
see
that
we
want
the
server
to
be
unique,
based
on
how
its
instantiate
it
see
how
this
is
an
HTT,
HTTP,
2
server,
and
this
one
is
secure
and
this
one
is
regular
HTTP.
A
So
going
back
over
to
the
types
we
see
that
we
don't
currently
get
that
let's
quickly
switch
our
on
part
one
over
to
the
different
types
and
see
what
happens
instead.
So
we'll
call
this
init
and
we'll
see
that
now
the
FAFSA
Phi
instance
is
always
the
same.
It's
always
fast
if
I
options
and
that
server
is
always
going
to
be
server,
Union,
not
ideal.
So
let's
fix
this
start
by
renaming
that
back
go
over
to
this
file
and
we'll
rename
it
as
well
just
to
fast.
If
I
types.
A
And
then
we're
going
to
need
the
two
and
the
two
secure
now
for
the
HTTP
options,
we're
going
to
go
ahead
and
we're
going
to
copy
over
that
secret
property.
We're
keep
it
as
optional,
because
any
one
of
these
four
can
have
this
property
and
then
we're
going
to
do
that
is
by
using
a
intersection
we're
going
to
intersect
the
other
three
types
with
that
base
type.
A
So
this
is
a
sort
of
inheritance
model
where
all
three
of
these
other
types
are
all
going
to
include
everything
in
this
type
and
then
whatever
is
specified
on
their
own.
So,
let's
start
with
HTTPS
we're
actually
going
to
take
this
property
here
and
we're
going
to
use
those
base
server
options
and
we're
gonna
make
it
required
now.
This
means
that
this
type
will
only
ever
be
possible
if
the
user
defines
this
property
and
only
this
property,
that's
the
power
of
discriminative
unions.
A
So
let's
take
a
look
at
how
you
know
this
feeds
into
the
HTTP
to
instead
of
it
being
boolean
we're
actually
gonna
go
ahead
and
use
a
type
literal
of
true.
So
now
the
user
will
get.
This
options
object
if
they've
specified
only
HDB
to
option
and
only
specified
it
as
true
and
then
for
the
secure
version
of
the
HDP
to
server
we're
going
to
use
that
true
again
and
we're
also
going
to
use
the
HTTP
options.
A
So
it's
sort
of
like
an
and
operation
where,
if
it's
both
of
these
properties
are
defined,
we
know
we
have
a
secure
server
and
we're
gonna
go
ahead
and
change.
This
type
to
that
HTTP
two
and
we're
going
to
make
it
the
secure
server
options.
So
let's
go
ahead
and
remove
this
interface
and
we're
gonna
have
to
update
that
down
here.
A
So
now
in
this
function,
we're
gonna
copy
it
four
times
the
one
at
the
bottom
here
is
going
to
use
the
HTTP
options,
then,
for
the
three
previous
to
it,
we're
going
to
specify
it
for
the
three
other
ones
we've
defined
here
and
we're
going
to
make
them
non
optional,
so
we're
going
to
start
with
HTTP,
then
HTTP
and
then
HTTP
secure,
and
now
this
FAFSA
file
check.
This
function
is
currently
already
implementing
a
discriminant
Union.
A
You
can
see
that
has
those
overloads
on
the
right
side
of
this
code
sense
we're
in
there's,
multiple
options
when
this
can
be
type
scripts
is
intelligent
enough
to
say:
hey.
We
have
these
four
possibilities
for
what
this
options
object
can
be.
So
let's
look
at
the
difference
between
them
all
and
if
they
have
enough,
they
differ
if
they
have
something
that
is,
you
know,
discriminately
different.
In
this
case
you
know
the
existence
of
certain
properties
over
others.
Then
typescript
is
smart
enough
to
you
know,
return
exactly
what
we
want
so
now.
A
Let's
use
that
to
our
advantage
to
make
sure
that
we
specify
the
specific
types.
You
know
that
specific
node
server
based
on
the
different
kind
of
options,
so
we're
gonna,
add
a
generic
here
called
server.
It's
going
to
extends
from
that
server,
Union
that
we've
already
written
and
then
instead
of
that
server
being
defined,
as
you
know,
any
one
of
these
four
it's
going
to
be
whichever
this
generic
is.
While
we're
doing
this,
we're
also
going
to
default
it
to
the
HTTP
server
type.
This
will
allow
this.
A
You
know
this
non
optional,
one
to
work
best
so
now
down
here
we're
going
to
pass
that
server,
but
instead
of
specifying
the
Union
we're
gonna
pass
in
the
certain
ojs
server
type
that
we
want
to
correspond
to
the
give
an
option
set
and
type
script
will
respect
this
generic
parameter
as
a
part
of
the
overload
and
we'll
return.
The
FAFSA
fee
instance
with
the
node
server
that
we
want
specifically
finally
HTTP
server
great.
A
So
now,
if
we
jump
back
over
to
part,
one
you'll
see
that
we're
still
using
our
new
types
and
if
we
hover
over
these
you'll
see
that
not
only
are
the
options
now,
you
know
specified
based
on
what
has
been
passed
in,
but
the
server
types
are
as
well
and
now,
we've
achieved
part
one
discriminate,
unions
and
function
overloading
now
on
to
part
two.
So
in
part,
two
we're
going
to
talk
about
named
generic
parameters,
so
see
here
we
have
our
server
and
in
the
previous
section
we
were
able
to
make.
A
You
know
the
server
based
to
be
a
specific
kind
of
FAFSA
fie
instance
based
on
the
options
passed
to
it.
But
now
we
want
to
make
something
unique
out
of
this.
Using
this
get
property
where
it's
gonna
be
a
route
handler
common
to
many
HTTP
server
to
server
frameworks
where
you
pass
in
a
path
and
then
you
pass
in
some
set
of
handlers.
A
In
our
case,
we're
gonna
have
two
handlers:
we're
gonna
have
an
options,
object
that
allows
you
to
specify
a
pre
handler
and
then
we're
gonna
have
that
third
argument
on
our
you
know
overall
get
function
that
lets
you
specify
the
route
handler
itself
and
the
idea
here
is
that
if
this
pre
handler
doesn't
return
true,
then
this
one
won't
run,
but
what's
unique
here
is
we
want
to
consider
that
this
request
object?
We
want
it
to
inherit
the
the
same
headers
in
query
that
we
specify
in
this
object
in
this
generic
here.
A
But,
furthermore,
this
generic
needs
to
be
sort
of
dynamic
where,
if
a
route
that
is
someone
is
creating
only
has
headers,
we
want
them
to
be
able
to
only
specify
the
headers
type
and
not
have
to
deal
with
the
other
types.
In
fact,
this
one
is
going
to
be
so
powerful
that
it's
going
to
contain
the
types
for
things
like
body
as
well,
which
you
know
doesn't
exist
on
a
get
request.
A
A
Put
the
request,
stop
body
here
and
we're
gonna
go
ahead
and
make
sure
we
pass
in
that
final
function,
request
response
and
we'll
check
out
that
request
that
body
you
can
see
here
that
body
now
contains
that
string
so
great.
How
do
we
do
this?
Let's
jump
back
into
our
definition,
definitions
before
we
do
that.
Let's
change
this
comment
over,
so
you
can
see
things
are
failing,
but
now
over
here,
let's
take
a
look
at
the
FAFSA
Phi
instance.
The
FAFSA
fire
incidents
is
what
contains
that
get
and
post
function.
A
A
That's
going
to
take
three
properties,
the
route
which
is
the
string,
the
options
which
we're
going
to
call
FAFSA
five
out
options,
and
then
the
handler
we're
gonna
call
classify
route
handler,
and
we
know
this
is
going
to
return
the
void
so
keep
in
mind.
So
now,
let's,
let's
take
one
step
back.
We
realize
now
that
we're
specifying
things
like
the
get
in
the
post
at
this
level,
and
we
talked
about
that
generic
before.
So.
How
are
we
going
to
pass
that
generic
through
to
these
functions?
A
A
Parameter
generic
we're
gonna
pass
it
through
both
of
these
pieces.
So
next
we're
gonna
start
with
the
FAFSA
fire
out
options.
Cuz,
it's
an
easy
one.
Obviously
pacify
route
options.
We're
gonna
have
that
generic
R
and
we're
gonna
copy
over
the
same
constraint
as
the
previous
one
and
you'll
see
here
that
the
type
now
exists
on
the
type
itself
and
not
on
the
inner
piece,
and
that's
because
the
user
won't
necessarily
have
to
pass
us
in
themselves
every
time
they
use
it
here.
A
We're
gonna
have
a
pre
handler
method
and
we're
going
to
have
that
refer
to
a
pacifier
out
handler,
because
it's
about
the
same,
we're
gonna
give
it
our
then.
Finally,
we're
gonna
type,
the
FAFSA
five
route
handler,
which
again
is
a
function,
and
we
will
consider
that
that
function
is
going
to
have
two
types
request
which
is
going
to
be
a
facet
by
request
and
res
we're.
A
Gonna
keep
our,
as
is
unknown
for
simplicity
sake,
because
we
it's
about
the
same
as
the
request
type,
but
we're
only
focusing
on
requests
right
now,
and
we
also
need
to
use
that
generic
here
notice,
how
we
passed
that.
So,
let's
take
that
again,
let's
take
that
piece
put
it
here
on
the
outside
and
pass
it
through
to
the
request
and
for
the
final
trick.
We're
gonna
find
the
FAFSA
five
request
type.
A
So
you
can
see
how
we
really
break
this
up,
so
it
makes
it
really
extensible
we're
gonna
pass
in
our
here
again,
so
we'll
copy
that
over
and
now
we
know,
that's
that
fast.
If
I
request
is
an
object
and
now
this
object
is
going
to
have
the
corresponding
for
properties,
headers,
queries
and
parameters.
Take
a
quick
taking
a
quick
look
back
at
part
two.
You
see
that
we
just
call
them
the
same
thing
but
lower
case,
but
we
want
them
to
correspond
to
whatever's
in
the
generic.
A
A
We've
made
one
one
over
site:
the
properties
in
the
generic
all
need
to
be
optional
and
that
enables
that
default
operation
to
go
into
effect
with
the
unknowns.
So
what
so
the
difference
is
is
here:
we've
made
these
all
optional
now
and
they'll
default
to
unknown.
Through
this
sort
of
you
know,
generic
constraining
and
defaulting.
So
when
R
is
specified,
as
only
you
know,
an
object
containing
that
headers
prop
then
it'll
only
set
that
one
here
it'll
set
the
others,
but
it'll
default,
the
others
to
whatever
that
default
is
here,
which
again
is
just
unknown.
A
It's
a
little
bit
of
a
like
very
much
shared
interface
experience,
but
it
turns
out
to
work
really
well
and
work
out
in
our
favor
because,
as
you
can
see,
the
headers
correspond
to
the
type
defined
here
and
thus
concluding
part
to
implementing
named
generic
parameters
all
right.
So
here
we
are
in
part
three
and
we
are
going
to
be
covering
declaration
merging
in
implementing
a
plugin
system
for
our
fafsa
phi
instance.
So,
taking
a
look
at
the
you
know,
the
fafsa
phi
javascript
implementation,
you
can
see.
A
We
have
two
functions:
there's
decorate,
which,
given
a
key
value
pair,
will
add
that
key
value
pair
to
the
fafsa
phi
instance,
and
then
we
have
the
register
function,
which,
given
a
plugin
in
an
options,
object
we
will
apply
the
you
know
the
local
philosophy
instance
to
that
plug-in
with
its
options.
This
this
methodology
of
a
plug-in
system
will
allow
the
plugins
to
call
things
like
this
dot
daiquiri,
but
from
a
typescript
perspective,
you
know
plug
the
plug-in
or
not
calling
this
dot.
A
Daiquiri
is
gonna,
be
you
know
a
little
difficult
wow
we
could
add
a
type
to
our
server
to
say
you
know
you
know,
any
additional
property
could
be
of
type
any.
It
doesn't
really
solve
much
for
us,
but
instead,
if
we
had
a
you
know
a
file
like
we
do
here
or
we're
calling
you
know,
art
dot,
decorate
on
our
server.
A
In
that
same
file,
we
can
actually
write
a
declaration
merging
for
our
FAFSA
fight
instance
with
that's
with
that
value,
and
you
can
expect
it
to
be
here
as
string,
but
as
a
part
of
this
section,
I
also
want
to
show
a
little
bit
of
the
magic
that
we
can
do
with
plugins
and
a
little
bit
of
generic
and
inference.
So,
let's
take
a
look
at
our
whisper
plugin
first
we'll
say
here
in
our
implementation:
you
can
see
that
we're
registering
the
whisper
plugin
and
we're
passing
it.
A
The
local
secret
that
we've
set
on
the
line
above
so
keep
in
mind
that
fast,
if
I,
will
take
this
plug-in
function
and
will
pass
it
the
instance
pacify
server
as
well
as
this
object
here
with
the
specified
options.
So
taking
a
look
at
our
plugin,
we
can
see
that
all
it
does
is
call
dot
decorate
on
that
instance,
and
it
and
then
it
you
know,
whispers
the
secret.
A
So
we
can
take
a
look
at
the
final
typescript
definition
again
before
we
write
it
ourselves,
and
you
can
see
that
we
have
that
fast
if
I
plug
in
interface
as
well
as
those
two
methods.
So
let's
ran
it
ourselves
and
explain
it
as
we
go
in
fast
if
I
type
definition
file
we're
going
to
start
with
that
decorate
method,
it's
pretty
easy
to
implement
passage
key.
It's
a
string
and
the
value
in
our
case
we're
just
gonna
use
any.
A
You
could
probably
use
unknown
here
and
make
the
user
specify
exactly
what
that
value
is
during
runtime
to
make
it
a
little
bit
better,
but
for
all
intensive
purposes
any
should
be
okay.
Here
then
we're
gonna
have
that
register
function.
Now,
remember
that
register
function
gets
a
plug-in
and
that
plug-in
we're
gonna
call
fast.
If
I
plug
in
and
any
options
it's
going
to
be
plug
in
options
and
we're
gonna
have
this
function
just
return
void.
A
A
So
this
is
one
of
my
favorite
tricks
in
typescript,
where
we
have
a
generic
defined
for
this
function
register,
but
we've
also
specified
it
here
as
well
as
here.
So
let's
write
the
FAFSA
fide
plug-in
interface.
We're
gonna
export
this
one
as
well,
because
we're
going
to
use
it
in
our
whisper
plug-in
definition
file,
call
facet,
5
plug-in
we're
going
to
you
know.
It's
also
gonna
have
that
plug-in
options
in
our
face
and
this
interface
is
going
to
just
return
a
function.
A
That
function
is
going
to
contain
the
instance,
the
FASTA
Phi
and
the
options,
and
it's
going
to
return
void,
you'll
notice
that
we're
not
doing
anything
with
the
server
generic
for
this
specify
instance
and
there's
a
reason
for
that.
It,
it's
a
there's
a
longer
reason,
but
the
short
version
of
it
is
when
you,
when
we
have
a
plug-in
system
like
here
the
plug-in
author
won't
know
what
type
of
instance
is
going
to
get
passed
here.
It
could
be
anything
it
could
be
HTTP
HTTP
to
HPS
if
their
plugin
doesn't
care.
A
What
kind
of
instance
it
is,
and
neither
does
its
type
and
if
its
plug-in
does
care
what
kind
of
type
the
server
is
then
we
probably
will
have
to
handle
that
logic
from
within
the
plugin
and
there's
a
longer
conversation
that
we're
currently
having
on
you
know.
How
can
we
improve
this
sort
of
type
to
enable
that
extensibility,
but
going
back
to
this
plug-in
options?
Generic
if
we
were
to
define
an
instance
of
this
interface
here
and
pass
it
this
plug-in
options?
A
Generic
it'll
then
pass
that
itself
here,
as
well
from
the
perspective
of
the
register
function.
If
we
pass
a
a
type
implementation
of
this
interface
to
this
plug-in
property,
typescript
will
actually
figure
out
that
the
plug-in
options,
generic
that
is
defined
in
the
instance
of
this
interface
is
going
to
be
the
same
as
the
one
here
and
you
don't
need
to
write
it
twice.
So
what
does
that
all
mean?
A
A
Taking
a
look
at
that
implementation.
Now,
when
we
import
whisper
plug-in,
you
know,
whisper
plugin
is
of
type
classify
plug-in
and
if
you
remember,
register
takes
in,
you
know
that
first
option
is
a
fast
if
I
plug
in
so
it's
able
to
take
in
and
infer
the
generic
plug-in
options
based
on
the
definition
of
our
plug-in
I
know
that
can
be
a
little
confusing,
so
I
hope
this
code
snippet
showed
that.
But
the
last
point
I
want
to
make
here
is
back
to
the
whole
declaration
merging
when
you
have
something
like
the
whisper
plug-in.
A
That
is,
you
know,
adding
a
property
too
fast
if
I,
let's
go
ahead,
and
you
know,
while
we're
saying
this
change
these
comments
over
to
the
new
implementation,
and
we
can
see
that
we
are
extending
that
FAFSA
fee
instance
interface
with
that
whisper
secret.
Now
it
shouldn't
be
the
implementations
job
to
do
it.
Instead,
we
can
actually
use
the
same
declare
block
inside
of
the
type
of
inside
of
the
definition
here,
and
we
can
achieve
the
same
thing
where
let's
say
we
just
want
to
add
that
whisper
secret
property
from
our
plugin.
A
You'll
notice
that
whisper
secret
is
still
of
type
string
because
by
importing
that
plug-in
from
you
know
from
your
module
system,
the
definition
file
with
it
as
well
will
be
included
and
because
we're
you
know,
overwriting
the
or
merging
the
that
property
over
the
FAFSA
fight
instance
interface.
We
get
that
same
effect
and
inside
of
our
implementation
and
with
that
you've
implemented
implemented.
A
The
basic
plug-in
system
for
festivai
welcome,
back
I
hope
you
enjoyed
that
code,
the
code
walkthrough
that,
as
a
reminder,
the
topics
we
covered
today
include
discriminant
unions,
function,
overloading
name,
generic
parameters,
declaration
merging
and
generic
inference.
All
of
these
are
actively
in
use
over
in
the
actual
fafsa
fight
type
definitions
and
there's
plenty
of
more
information
available
on
type
scripts
documentation
to
learn
more
about
it.
A
If
you'd
like
to
learn
more
about
the
types
of
definitions
or
even
about
FAFSA
Phi
itself,
come
check
us
out
and
github
we're
always
accepting
of
new
contributors
and
contributions,
and
we
are
happy
to
include
you
in
our
community
once
again,
my
name
is
Ethan
Arawa
I'm,
a
software
engineer
at
Microsoft.
Thank
you
very
much
for
listening
to
my
talk
today.
You
can
find
me
on
Twitter
and
github
and
be
happy
to
chat
further
about
stripped,
fascist,
I
or
nodejs.