From bc782cee98096d2562d87c7a0b15051b6d0d6628 Mon Sep 17 00:00:00 2001 From: David Sherret Date: Wed, 13 Mar 2024 22:37:56 -0400 Subject: 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). --- tests/specs/npm/check_pkg_json_import/main.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 tests/specs/npm/check_pkg_json_import/main.ts (limited to 'tests/specs/npm/check_pkg_json_import/main.ts') diff --git a/tests/specs/npm/check_pkg_json_import/main.ts b/tests/specs/npm/check_pkg_json_import/main.ts new file mode 100644 index 000000000..72b887735 --- /dev/null +++ b/tests/specs/npm/check_pkg_json_import/main.ts @@ -0,0 +1,18 @@ +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(undefined); + +function unwrap(foo: Foo) {} + +export function useCSP() { + const foo = useContext(CTX); + // previously this was erroring + if (foo) { + unwrap(foo); + } +} -- cgit v1.2.3