Skip to content

Commit

Permalink
fix: Allow functions as properties again (#228)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrousavy authored Oct 15, 2024
1 parent 660de52 commit 9e70d3f
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions packages/nitrogen/src/createPlatformSpec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,6 @@ function getHybridObjectSpec(type: Type, language: Language): HybridObjectSpec {

if (Node.isPropertySignature(declaration)) {
const t = declaration.getType()
if (t.getCallSignatures().length > 0) {
// It's a function, but a prop! Use method signature.
throw new Error(
`${name}: Property "${prop.getName()}" is a function property. Use method syntax instead! (\`${prop.getName()}: () => void\` -> \`${prop.getName()}(): void\`)`
)
}
const propType = createType(t, prop.isOptional() || t.isNullable())
properties.push(
new Property(prop.getName(), propType, declaration.isReadonly())
Expand Down

0 comments on commit 9e70d3f

Please sign in to comment.