Skip to content

7.26.7 + ember-animated: Definietly assigned fields and fields with the 'declare' modifier cannot be initialized here, but only in the constructor #422

@NullVoxPopuli

Description

@NullVoxPopuli
 Definietly assigned fields and fields with the 'declare' modifier cannot be initialized here, but only in the constructor
  74 |   _inserted = false;
  75 |
> 76 |   @service('-ea-motion')
     |   ^
  77 |   motionService!: MotionService;
  78 |
  79 |   didInsertElement() {
error log

=================================================================================

ENV Summary:

  TIME: Wed Dec 15 2021 16:01:31 GMT-0500 (Eastern Standard Time)
  TITLE: ember
  ARGV:
  - 🏠/.volta/tools/image/node/16.13.0/bin/node
  - /✂️/my-app/node_modules/.bin/ember
  - s
  EXEC_PATH: 🏠/.volta/tools/image/node/16.13.0/bin/node
  TMPDIR: /tmp
  SHELL: /bin/bash
  PATH:
  - 🏠/.volta/tools/image/yarn/1.22.17/bin
  - 🏠/.volta/tools/image/node/16.13.0/bin
  - 🏠/.volta/bin
  - 🏠/.pyenv/plugins/pyenv-virtualenv/shims
  - 🏠/.pyenv/shims
  - 🏠/.pyenv/bin
  - /✂️/scripts/
  - 🏠/Applications
  - 🏠/apps/phantomjs/bin
  - 🏠/scripts/system-utils
  - 🏠/scripts/git
  - 🏠/scripts/rails
  - 🏠/scripts
  - 🏠/.volta/bin
  - 🏠/.local/bin
  - /usr/local/sbin
  - /usr/local/bin
  - /usr/sbin
  - /usr/bin
  - /sbin
  - /bin
  - /usr/games
  - /usr/local/games
  - /snap/bin
  - 🏠/.fzf/bin
  - /usr/lib/go-1.13/bin
  - /bin
  - 🏠/go/bin
  PLATFORM: linux x64
  FREEMEM: 1032192000
  TOTALMEM: 18851196928
  UPTIME: 498146.85
  LOADAVG: 6.01,3.28,1.59
  CPUS:
  - Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz - 2400
  - Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz - 2400
  - Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz - 2400
  - Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz - 2400
  - Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz - 2400
  - Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz - 2400
  - Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz - 2400
  - Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz - 2400
  ENDIANNESS: LE
  VERSIONS:
  - ares: 1.17.2
  - brotli: 1.0.9
  - cldr: 39.0
  - icu: 69.1
  - llhttp: 6.0.4
  - modules: 93
  - napi: 8
  - nghttp2: 1.45.1
  - nghttp3: 0.1.0-DEV
  - ngtcp2: 0.1.0-DEV
  - node: 16.13.0
  - openssl: 1.1.1l+quic
  - tz: 2021a
  - unicode: 13.0
  - uv: 1.42.0
  - v8: 9.4.146.19-node.13
  - zlib: 1.2.11

ERROR Summary:

  - broccoliBuilderErrorStack: SyntaxError: /✂️/my-app/ember-animated/components/animated-beacon.ts: Definietly assigned fields and fields with the 'declare' modifier cannot be initialized here, but only in the constructor
  74 |   _inserted = false;
  75 |
> 76 |   @service('-ea-motion')
     |   ^
  77 |   motionService!: MotionService;
  78 |
  79 |   didInsertElement() {
    at File.buildCodeFrameError (/✂️/my-app/node_modules/@babel/core/lib/transformation/file/file.js:249:12)
    at NodePath.buildCodeFrameError (/✂️/my-app/node_modules/@babel/traverse/lib/path/index.js:139:21)
    at Object.field (/✂️/my-app/node_modules/ember-animated/node_modules/@babel/plugin-transform-typescript/lib/index.js:69:22)
    at /✂️/my-app/node_modules/ember-animated/node_modules/@babel/plugin-transform-typescript/lib/index.js:280:33
    at Array.forEach (<anonymous>)
    at PluginPass.Class (/✂️/my-app/node_modules/ember-animated/node_modules/@babel/plugin-transform-typescript/lib/index.js:272:31)
    at newFn (/✂️/my-app/node_modules/@babel/traverse/lib/visitors.js:177:21)
    at NodePath._call (/✂️/my-app/node_modules/@babel/traverse/lib/path/context.js:53:20)
    at NodePath.call (/✂️/my-app/node_modules/@babel/traverse/lib/path/context.js:40:17)
    at NodePath.visit (/✂️/my-app/node_modules/@babel/traverse/lib/path/context.js:100:31)
  - code: [undefined]
  - codeFrame: /✂️/my-appy/ember-animated/components/animated-beacon.ts: Definietly assigned fields and fields with the 'declare' modifier cannot be initialized here, but only in the constructor
  74 |   _inserted = false;
  75 |
> 76 |   @service('-ea-motion')
     |   ^
  77 |   motionService!: MotionService;
  78 |
  79 |   didInsertElement() {
  - errorMessage: ember-animated/components/animated-beacon.ts: /✂️/my-app/ember-animated/components/animated-beacon.ts: Definietly assigned fields and fields with the 'declare' modifier cannot be initialized here, but only in the constructor
  74 |   _inserted = false;
  75 |
> 76 |   @service('-ea-motion')
     |   ^
  77 |   motionService!: MotionService;
  78 |
  79 |   didInsertElement() {
        in /tmp/broccoli-2291805DEFcpumdhqTh/out-0706-analyzer_ember_auto_import_analyzer
        at broccoli-persistent-filter:Babel > [Babel: ember-animated] (Babel: ember-animated)
  - errorType: Build Error
  - location:
    - column: [undefined]
    - file: ember-animated/components/animated-beacon.ts
    - line: [undefined]
    - treeDir: /tmp/broccoli-2291805DEFcpumdhqTh/out-0706-analyzer_ember_auto_import_analyzer
  - message: ember-animated/components/animated-beacon.ts: /✂️/my-app/ember-animated/components/animated-beacon.ts: Definietly assigned fields and fields with the 'declare' modifier cannot be initialized here, but only in the constructor
  74 |   _inserted = false;
  75 |
> 76 |   @service('-ea-motion')
     |   ^
  77 |   motionService!: MotionService;
  78 |
  79 |   didInsertElement() {
        in /tmp/broccoli-2291805DEFcpumdhqTh/out-0706-analyzer_ember_auto_import_analyzer
        at broccoli-persistent-filter:Babel > [Babel: ember-animated] (Babel: ember-animated)
  - name: Error
  - nodeAnnotation: Babel: ember-animated
  - nodeName: broccoli-persistent-filter:Babel > [Babel: ember-animated]
  - originalErrorMessage: /✂️/my-app/ember-animated/components/animated-beacon.ts: Definietly assigned fields and fields with the 'declare' modifier cannot be initialized here, but only in the constructor
  74 |   _inserted = false;
  75 |
> 76 |   @service('-ea-motion')
     |   ^
  77 |   motionService!: MotionService;
  78 |
  79 |   didInsertElement() {
  - stack: SyntaxError: /✂️/my-app/ember-animated/components/animated-beacon.ts: Definietly assigned fields and fields with the 'declare' modifier cannot be initialized here, but only in the constructor
  74 |   _inserted = false;
  75 |
> 76 |   @service('-ea-motion')
     |   ^
  77 |   motionService!: MotionService;
  78 |
  79 |   didInsertElement() {
    at File.buildCodeFrameError (/✂️/my-app/node_modules/@babel/core/lib/transformation/file/file.js:249:12)
    at NodePath.buildCodeFrameError (/✂️/my-app/node_modules/@babel/traverse/lib/path/index.js:139:21)
    at Object.field (/✂️/my-app/node_modules/ember-animated/node_modules/@babel/plugin-transform-typescript/lib/index.js:69:22)
    at /✂️/my-app/node_modules/ember-animated/node_modules/@babel/plugin-transform-typescript/lib/index.js:280:33
    at Array.forEach (<anonymous>)
    at PluginPass.Class (/✂️/my-app/node_modules/ember-animated/node_modules/@babel/plugin-transform-typescript/lib/index.js:272:31)
    at newFn (/✂️/my-app/node_modules/@babel/traverse/lib/visitors.js:177:21)
    at NodePath._call (/✂️/my-app/node_modules/@babel/traverse/lib/path/context.js:53:20)
    at NodePath.call (/✂️/my-app/node_modules/@babel/traverse/lib/path/context.js:40:17)
    at NodePath.visit (/✂️/my-app/node_modules/@babel/traverse/lib/path/context.js:100:31)

=================================================================================

The code that this comes from:

export default class AnimatedBeacon extends Component {
  name: string | undefined;

  layout: TemplateFactory = layout;
  tagName = '';
  _inserted = false;

  @service('-ea-motion')
  motionService!: MotionService;

  didInsertElement() {
    super.didInsertElement();

https://github.com/ember-animation/ember-animated/blob/master/addon/components/animated-beacon.ts#L76

I don't see declare 🤷

I probably need to figure out some lockfile changes (big monorepo, so I can't just re-roll it)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions