# What're Differences Between \`typed/racket/unsafe\` and \`typed/racket/optional\`?

**URL:** https://racket.discourse.group/t/whatre-differences-between-typed-racket-unsafe-and-typed-racket-optional/3746
**Category:** Questions & Answers
**Tags:** question, typed-racket
**Created:** [May 16, 2025, 4:49am UTC](https://racket.discourse.group/t/whatre-differences-between-typed-racket-unsafe-and-typed-racket-optional/3746 "2025-05-16T04:49:01Z")
**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: [May 16, 2025, 4:49am UTC](https://racket.discourse.group/t/whatre-differences-between-typed-racket-unsafe-and-typed-racket-optional/3746/1 "2025-05-16T04:49:01Z")

</div>

I'm writing a module that adds types to identifiers imported from untyped code, and I want to avoid contract generation. I see two approaches:

Using typed/racket/unsafe:

```scheme
(require typed/racket/unsafe)

```

Using typed/racket/optional with renamed imports:

```scheme
(require (rename-in typed/racket/base/optional
                    [require/typed unsafe-require/typed]
                    [provide unsafe-provide]
                    [require/typed/provide unsafe-require/typed/provide]
                    [cast unsafe-cast]))

```

My goal: Type bindings from untyped modules, trusting that the values already match their types.

Both approaches seem to bypass contract generation. But I'm unsure about their exact differences. Could someone clarify:

1. Are these approaches interchangeable, or do they have meaningful technical differences?

2. When should each be preferred?

I'd appreciate any insights about these mechanisms or pointers to relevant documentation. Thanks!

---

<div class="post-metadata">

### Author: ![EmEf](https://avatars.discourse-cdn.com/v4/letter/e/53a042/32.png) [@EmEf](https://racket.discourse.group/u/EmEf)
#### Post date: [May 16, 2025, 12:50pm UTC](https://racket.discourse.group/t/whatre-differences-between-typed-racket-unsafe-and-typed-racket-optional/3746/2 "2025-05-16T12:50:39Z")

</div>

On May 16, 2025, at 12:59 AM, Noah Ma via Racket Discourse [notifications@racket.discoursemail.com](mailto:notifications@racket.discoursemail.com) says he wants "Type bindings from untyped modules, trusting that the values already match their types” and asks whether someone “could .. clarify”. Given your goal, you want `#lang typed/racket/optional` as your module level language. (Ben G. created the ‘shallow’ and ‘optional’ variants for his research on making the overhead of T/U interactions tolerable.)
