summaryrefslogtreecommitdiff
path: root/tests/specs/npm/check_pkg_json_import/main.ts
blob: 72b8877352f695b0b297d4aabd84ce063d12c50d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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<Foo | undefined>(undefined);

function unwrap(foo: Foo) {}

export function useCSP() {
  const foo = useContext(CTX);
  // previously this was erroring
  if (foo) {
    unwrap(foo);
  }
}