mirror of
https://github.com/denoland/deno.git
synced 2024-12-20 22:34:46 -05:00
bc782cee98
Does a package resolve when resolving types for a directory (copying the behaviour that typescript does).
18 lines
404 B
TypeScript
18 lines
404 B
TypeScript
import { createContext } from "npm:@denotest/types-pkg-json-import";
|
|
import { useContext } from "npm:@denotest/types-pkg-json-import/hooks";
|
|
|
|
export interface Foo {
|
|
foo: string;
|
|
}
|
|
|
|
export const CTX = createContext<Foo | undefined>(undefined);
|
|
|
|
function unwrap(foo: Foo) {}
|
|
|
|
export function useCSP() {
|
|
const foo = useContext(CTX);
|
|
// previously this was erroring
|
|
if (foo) {
|
|
unwrap(foo);
|
|
}
|
|
}
|