1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-27 01:29:14 -05:00
denoland-deno/tests/specs/npm/check_pkg_json_import/main.ts
David Sherret bc782cee98
fix(node): resolve types via package.json for directory import (#22878)
Does a package resolve when resolving types for a directory (copying the
behaviour that typescript does).
2024-03-13 22:37:56 -04:00

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