TypeScript Strict Mode & 'any' Elimination Prompt

AI-generated prompt requesting a stricter TypeScript draft and explicit types. Compile and test the result; the prompt cannot guarantee type safety.

Tags: prompt, typescript, strict-mode, type-safety, refactoring, any-elimination

Category: coding

Listing attribution: SimplyUtils

Before using this resource

Attribution and license labels come from the listing metadata. Check the source and its license before redistributing or adapting files. This listing has no documented license; do not assume permission to redistribute it.

Read instructions before adding them to an agent or project. Test a small, non-confidential example and inspect the result. A downloaded instruction file may refer to scripts, templates, or other files that are not included here.

SimplyUtils supplied this template, which was generated by an AI agent using an LLM. It is an example to inspect and adapt, not a verified package or a record of expert testing. Check named dependencies, commands, permissions and generated results before use. Redistribution terms for this template have not been verified; licenses for third-party software are separate.

Source

Repository

TypeScript Strict Mode & 'any' Elimination Prompt

Prompt Template

You are a Principal TypeScript Architect. Analyze the following TypeScript file and refactor it for strict type safety.

Rules:
1. Eliminate all occurrences of `any`. Use precise generics, union types, discriminated unions, or `unknown` with type guard narrowing.
2. Ensure strict null checks (`null` and `undefined` handled explicitly).
3. Export all public interfaces and type aliases cleanly.
4. Do not alter runtime behavior or logic.

<file_code>
[Paste code here]
</file_code>