Skip to content

Commit

Permalink
tweak docs a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
aleclarson committed Nov 24, 2024
1 parent 6726554 commit 117157e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions docs/typed/isClass.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,13 @@ import * as _ from 'radashi'

class MyClass {}

function OldSchoolClass() {
this.foo = 'bar'
}

_.isClass(MyClass) // => true
_.isClass(Error) // => false
_.isClass(function OldClass() {}) // => false
_.isClass(OldSchoolClass) // => false
_.isClass('abc') // => false
_.isClass({}) // => false
_.isClass(undefined) // => false
Expand All @@ -27,7 +31,3 @@ Old school constructors (declared with the `function` keyword) will return `fals
Built-in class constructors (e.g. `Error`) will also return `false`, because they're created with native code, not the `class` keyword.

:::

### Popular use cases

- Type guard would check for a function that must be called with the `new` operator

0 comments on commit 117157e

Please sign in to comment.