# How to Require Macros from Untyped Racket in Typed Racket with Dependencies on Typed Imports?

**URL:** <https://racket.discourse.group/t/how-to-require-macros-from-untyped-racket-in-typed-racket-with-dependencies-on-typed-imports/3349>\
**Category:** Questions & Answers\
**Tags:** question, typed-racket, macro\
**Created:** [November 23, 2024, 5:15am UTC](https://racket.discourse.group/t/how-to-require-macros-from-untyped-racket-in-typed-racket-with-dependencies-on-typed-imports/3349 "2024-11-23T05:15:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![NoahStoryM](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/noahstorym/32/17_2.png) [@NoahStoryM](https://racket.discourse.group/u/NoahStoryM)\
**Post date:** [November 23, 2024, 5:15am UTC](https://racket.discourse.group/t/how-to-require-macros-from-untyped-racket-in-typed-racket-with-dependencies-on-typed-imports/3349/1 "2024-11-23T05:15:40Z")

</div>

# How to Require Macros from Untyped Racket in Typed Racket with Dependencies on Typed Imports?

I'm facing an issue when trying to require a macro defined in an untyped Racket  
module into a Typed Racket module. The macro depends on a function from the same  
untyped module. Here's an example:

```scheme
Welcome to Racket v8.15 [cs].
> (module m racket
    (provide (all-defined-out))
    (define (g y) y)
    (define-syntax (f stx)
      (syntax-case stx ()
        [(_ x)
         #'(g x)])))
> (require 'm)
> (f 0)
string:7:10: Type Checker: missing type for identifier;
 consider using `require/typed' to import it
  identifier: g
  from module: (quote m)
  in: g
 [,bt for context]
> (require/typed 'm [g (-> Number Number)])
> (g 0)
- : Number
0
> (f 0)
string:7:10: Type Checker: missing type for identifier;
 consider using `require/typed' to import it
  identifier: g
  from module: (quote m)
  in: g
 [,bt for context]

```

Unfortunately, even though `g` is typed, `f` still doesn't recognize the type of  
`g`. However, when `f` uses built-in functions like `add1`, it works without any  
issues:

```scheme
Welcome to Racket v8.15 [cs].
> (module m racket
    (provide (all-defined-out))
    (define-syntax (f stx)
      (syntax-case stx ()
        [(_ x)
         #'(add1 x)])))
> (require 'm)
> (f 0)
- : Integer [more precisely: One]
1

```

Why doesn't the `require/typed` type information for `g` propagate to `f`, and  
how can I properly use macros from an untyped Racket module that depend on typed  
imports?

---

<div class="post-metadata">

**Author:** ![samth](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/samth/32/3_2.png) [@samth](https://racket.discourse.group/u/samth)\
**Post date:** [November 25, 2024, 6:13pm UTC](https://racket.discourse.group/t/how-to-require-macros-from-untyped-racket-in-typed-racket-with-dependencies-on-typed-imports/3349/2 "2024-11-25T18:13:58Z")

</div>

Your macro is not referring to the `g` that you imported, it's referring to the `g` from the definition. (If you write examples in modules it will be clearer.)

The short answer is that there is not a way to make this work, because there's no way to tell Typed Racket about the internals of your module.
