Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Calling capitalize() on undefined returns an unhelpful error message

Open
#253 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
38/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
typescript

Research direction

Reproduce the call to capitalize(undefined) from the linked Ember Twiddle and inspect the capitalize entry point in @ember/string while watching the devtools console. Done means the undefined case reports a helpful, intentional error instead of the low-level replace TypeError.

Written by the indexing model from the issue text.

Description

The problem

When calling capitalize() on undefined:

import { capitalize } from '@ember/string';

return capitalize(undefined);

One will get a weird error:

Uncaught TypeError: Cannot read property 'replace' of undefined
    at Cache.func (ember.debug.js:41546)
    at Cache.get (ember.debug.js:30881)
    at Object.capitalize (ember.debug.js:41770)
    at ApplicationController.get foo [as foo] (about:srcdoc:35)
    at getPossibleMandatoryProxyValue (ember.debug.js:14419)
    at get (ember.debug.js:14485)
    at ember.debug.js:46909
    at runInAutotrackingTransaction (ember.debug.js:54899)
    at track (ember.debug.js:55486)
    at PropertyReference.value (ember.debug.js:46908)
Dominant language
TypeScript
Stars
4
Forks
14
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from emberjs/ember-string

All issues in emberjs/ember-string

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.