piotrwitek / utility-types

Collection of utility types, complementing TypeScript built-in mapped types and aliases (think "lodash" for static types).
MIT License
5.54k stars 230 forks source link

Is there any way to use these types without import 'utility-types' #188

Closed FrankFang closed 1 year ago

FrankFang commented 1 year ago

For now:

import { Optional } from 'utility-types'
type X = Optional<Person, 'name'>

What I expected is:

type X = Optional<Person, 'name'>

I've tried Triple-Slash Directives, but it did not work.

piotrwitek commented 1 year ago

import type { Optional } from 'utility-types'

FrankFang commented 1 year ago

I mean using type Optional without any import statement. Is that possible?

piotrwitek commented 1 year ago

should be, if you declare it in the global space. But please keep in mind it was not designed to be used like that so you need to figure it out on your own. Sorry