Detecting AI-generated JavaScript and TypeScript

Web development courses face AI-written code in its most complete form: assistants that write a whole page, and app builders that generate a full project from a sentence. Modern JavaScript also looks polished by default, which makes the line between a well-taught student and a model harder to see. This guide covers what actually distinguishes generated JavaScript, TypeScript and React, and how to set up a check that is fair.

Checks every file against classmates, the web and AI, in 65+ languages.

Why JavaScript is harder than most languages

  • Tooling makes everyone look professional. Prettier and ESLint give every project the same layout and style. Modern syntax is the default in every tutorial.
  • Scaffolding generates code. Vite, Next.js and other starters create files the student never wrote, and those files are identical across the class.
  • Projects are large and multi-file. A single assignment may contain dozens of components. Generated parts can be mixed with written ones.
  • AI app builders exist. Some tools produce a complete working web app from a description, with a design system and routing already in place.

The practical consequence: in JavaScript, focus on the files that contain the assignment's logic, and on the student's process, more than on style.

Habits of AI-written JavaScript

HabitWhat it looks likeWeight
JSDoc everywhereTyped @param and @returns blocks on every function in a plain JS fileWeak to moderate
Defensive asyncEvery await wrapped in try/catch, response.ok checks, console.error with a descriptive messageModerate
Defensive operators?. and ?? on values that can never be missing in the taskWeak to moderate
TypeScript beyond the courseGenerics, utility types such as Partial<T> and Record<K, V>, discriminated unions in a beginner projectModerate
Familiar generated phrasingError messages and comments in the stock style models use, such as "HTTP error! status:"Moderate
Polish nobody gradedARIA attributes, loading and empty states, responsive breakpoints in a logic exerciseModerate
A different specFeatures the brief did not ask for, and a requirement it did ask for missingStrong

An illustration

A small fetch, two ways Load a list of users and show their names
Illustration
Typical course answerusers.js
1fetch("/api/users")2 .then(res => res.json())3 .then(users => {4 for (const u of users) {5 list.innerHTML += "<li>" + u.name + "</li>";6 }7 });
Submittedusers.js
1/**2 * Fetches users and renders their names.3 * @param {HTMLElement} container - The list element.4 * @returns {Promise<void>}5 */6async function renderUsers(container) {7 try {8 const response = await fetch("/api/users");9 if (!response.ok) {10 throw new Error(`HTTP error! status: ${response.status}`);11 }12 const users = await response.json();13 container.replaceChildren(14 ...users.map(({ name }) => {15 const li = document.createElement("li");16 li.textContent = name ?? "Unknown";17 return li;18 })19 );20 } catch (error) {21 console.error("Failed to fetch users:", error);22 }23}
async/await taught: yesJSDoc required: noError handling taught: later

The second version is safer and more professional: it checks the response, avoids innerHTML and handles errors. The familiar "HTTP error! status:" message, full JSDoc and defensive nullish fallback, together and beyond the course, are what make it worth a conversation. None of them proves anything alone.

React and front-end projects

React code generated by assistants has its own recognisable profile, worth knowing if you teach front-end development:

  • Memoisation by reflex. useCallback and useMemo on trivial handlers and values, where a beginner would not yet know they exist.
  • Complete component anatomy. Props typed with an interface, default values, loading, error and empty states, all present from the first version.
  • Consistent styling systems. Utility classes or a component library applied uniformly across every file.
  • Custom hooks extracted early. A useFetch or useLocalStorage hook in a small project.

Projects generated by an AI app builder go further: the whole repository appears at once, with routing, a design system and a README, usually in one or two commits. Commit history and a short walkthrough of the code are more decisive here than any single file. See detecting vibe coding.

Preparing a fair check

  1. Leave out dependencies and build output. No node_modules, dist, build or lock files.
  2. Leave out the scaffolding. Configuration and template files every student received from the starter should not be in the comparison. Upload the starter as starter code so it is excluded.
  3. Keep the files students wrote. Components, modules, scripts and styles that carry the assignment's logic.
  4. Ask for the repository history in the submission, or a link to it, for larger projects.

AI detection for JavaScript and TypeScript

Codequiry's AI detection is trained on source code and reads JavaScript, TypeScript, JSX and TSX. Each file gets a likelihood with the reasons behind it and the passages that drove it. The same check compares students with each other by structure and searches the web, GitHub and Stack Overflow, where front-end tutorials and starter projects are plentiful.

Check a web development assignment

AI likelihood per file with reasons, plus classmate and public-code matching.

As with any AI result, treat it as a reason to look closer. Ask the student to explain a component and change its behaviour; read how to tell if code is AI generated for the full review method and how AI detectors work for what the score means.

Frequently asked questions

How can you tell if JavaScript was written by AI?

Look for a combination: JSDoc on every function, async/await with try/catch around every call, optional chaining and nullish coalescing used defensively, input validation the task did not need, and in React, memoisation hooks and accessibility attributes that a beginner rarely adds unprompted. Compare with the student's earlier work and ask them to explain it.

Is modern JavaScript syntax a sign of AI?

No. const, arrow functions, template literals and destructuring are taught in every current course and generated by every linter-friendly tutorial. Only features well beyond the course, used consistently and fluently, are a signal.

Can AI detection work on React and TypeScript?

Yes. Codequiry's AI detection is trained on source code and reads .js, .jsx, .ts and .tsx files, giving each a likelihood with its reasons. Exclude generated scaffolding and dependencies from uploads so the check sees only what students wrote.

What about projects built with AI app builders?

Tools that generate a whole web app from a description produce large, uniform codebases, often with a component library, consistent naming and a polished README from the first commit. Commit history and a walkthrough of the code are the strongest evidence.

Should I upload node_modules?

No. Dependencies are third-party code, are identical across students and will swamp the results. Upload the source folders, and exclude build output and anything the scaffolding tool generated.

Check JavaScript for AI-written code

Likelihood and reasons for every .js, .ts, .jsx and .tsx file, with classmate and web matching.

Start a check Pay as you go with credits. Comparing files is free.