---
title: "findUseTypeshadeDirective(): function in Authoring"
description: "findUseTypeshadeDirective, a function in Authoring. Scan the top-level statements of a SourceFile and return the first \"use typeshade\"; directive…"
url: https://typeshade.dev/api/findusetypeshadedirective/
language: en
---

# `findUseTypeshadeDirective()`

Function in Authoring

Scan the top-level statements of a SourceFile and return the first "use typeshade"; directive, or undefined if none is present.

`import { findUseTypeshadeDirective } from 'typeshade'`

The signature, the description and the examples come from the compiler's own source at commit af54ddad5.

## Syntax

```ts
function findUseTypeshadeDirective(
  sourceFile: ts.SourceFile,
): ts.ExpressionStatement | undefined
```

## Parameters

**`sourceFile` `ts.SourceFile`**

## Return value

`ts.ExpressionStatement | undefined`

## Description

Only direct children of the SourceFile are examined (no nested scopes).

## Source

[`src/compiler/ts/directive.ts`, line 25](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/directive.ts#L25), at commit af54ddad5
