Skip to content

Instantly share code, notes, and snippets.

@kaybutter
kaybutter / null-to-undefined.ts
Last active August 13, 2018 09:20
Null to Undefined
/**
* Converts an optional type that accepts null to an optional type
* that accepts undefined
*/
type NullToUndefined<T> = T extends null ? undefined : T
/**
* Converts an object type with optional properties that allow null to a
* type with properties that allow undefined instead. Non-Optional
* properties will remain unchanged.

Keybase proof

I hereby claim:

  • I am kaybutter on github.
  • I am kaybutter (https://keybase.io/kaybutter) on keybase.
  • I have a public key ASDAnmzk2wrYA4X_JrElRL1bG5nzRpnkyH5lSuc3h-7_0go

To claim this, I am signing this object:

@kaybutter
kaybutter / gist:e9a451fdfda10c25a2af
Created May 23, 2015 16:06
twilight syntax highlighting for swift in jekyll
.highlight { background: #181818; padding: 16px; overflow: auto; line-height: 1.2; border-radius: 0.2em }
.highlight pre { margin: 0}
.highlight code { color: #F8F8F8; font-family: "Source Code Pro", Menlo, monospace; font-size: 70% }
.highlight .hll { background-color: #ffffcc }
.highlight .c { color: #5F5A60; font-style: italic } /* Comment */
.highlight .err { border:#B22518; } /* Error */
.highlight .k { color: #CDA869 } /* Keyword */
.highlight .cm { color: #5F5A60; font-style: italic } /* Comment.Multiline */
.highlight .cp { color: #5F5A60 } /* Comment.Preproc */
.highlight .c1 { color: #5F5A60; font-style: italic } /* Comment.Single */