1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-29 16:30:56 -05:00
denoland-deno/tests/specs/npm/check_pkg_json_import/main.ts

19 lines
404 B
TypeScript
Raw Normal View History

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);
}
}