Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npm run build typescript compile errors #4482

Closed
btakita opened this issue Feb 28, 2020 · 9 comments
Closed

npm run build typescript compile errors #4482

btakita opened this issue Feb 28, 2020 · 9 comments

Comments

@btakita
Copy link
Contributor

btakita commented Feb 28, 2020

When running npm run build

> svelte@3.15.0 tsd /home/brian/work/sveltejs/svelte
> tsc -p src/compiler --emitDeclarationOnly && tsc -p src/runtime --emitDeclarationOnly

src/compiler/compile/Component.ts:242:16 - error TS2339: Property 'name' does not exist on type 'BaseNode'.

242                                     if (node.name[0] === '@') {
                                                 ~~~~

src/compiler/compile/Component.ts:243:17 - error TS2339: Property 'name' does not exist on type 'BaseNode'.

243                                             if (node.name[1] === '_') {
                                                         ~~~~

src/compiler/compile/Component.ts:244:40 - error TS2339: Property 'name' does not exist on type 'BaseNode'.

244                                                     const alias = this.global(node.name.slice(2));
                                                                                       ~~~~

src/compiler/compile/Component.ts:245:14 - error TS2339: Property 'name' does not exist on type 'BaseNode'.

245                                                     node.name = alias.name;
                                                             ~~~~

src/compiler/compile/Component.ts:247:25 - error TS2339: Property 'name' does not exist on type 'BaseNode'.

247                                                     let name = node.name.slice(1);
                                                                        ~~~~

src/compiler/compile/Component.ts:259:14 - error TS2339: Property 'name' does not exist on type 'BaseNode'.

259                                                     node.name = alias.name;
                                                             ~~~~

src/compiler/compile/Component.ts:263:21 - error TS2339: Property 'name' does not exist on type 'BaseNode'.

263                                     else if (node.name[0] !== '#' && !is_valid(node.name)) {
                                                      ~~~~

src/compiler/compile/Component.ts:263:55 - error TS2339: Property 'name' does not exist on type 'BaseNode'.

263                                     else if (node.name[0] !== '#' && !is_valid(node.name)) {
                                                                                        ~~~~

src/compiler/compile/Component.ts:265:64 - error TS2339: Property 'name' does not exist on type 'BaseNode'.

265                                             const literal: Literal = { type: 'Literal', value: node.name };
                                                                                                        ~~~~

src/compiler/compile/Component.ts:268:16 - error TS2339: Property 'key' does not exist on type 'BaseNode'.

268                                                     parent.key = literal;
                                                               ~~~

src/compiler/compile/Component.ts:272:16 - error TS2339: Property 'property' does not exist on type 'BaseNode'.

272                                                     parent.property = literal;
                                                               ~~~~~~~~

src/compiler/compile/Component.ts:273:16 - error TS2339: Property 'computed' does not exist on type 'BaseNode'.

273                                                     parent.computed = true;
                                                               ~~~~~~~~

src/compiler/compile/Component.ts:527:50 - error TS2339: Property 'label' does not exist on type 'BaseNode'.

527                     if (node.type === 'LabeledStatement' && node.label.name === '$') {
                                                                     ~~~~~

src/compiler/compile/Component.ts:721:17 - error TS2345: Argument of type 'BaseNode' is not assignable to parameter of type 'Node'.
  Type 'BaseNode' is not assignable to type 'ExportSpecifier'.

721                     if (map.has(node)) {
                                    ~~~~

src/compiler/compile/Component.ts:722:22 - error TS2345: Argument of type 'BaseNode' is not assignable to parameter of type 'Node'.
  Type 'BaseNode' is not assignable to type 'ExportSpecifier'.

722                             scope = map.get(node);
                                                ~~~~

src/compiler/compile/Component.ts:765:17 - error TS2345: Argument of type 'BaseNode' is not assignable to parameter of type 'Node'.
  Type 'BaseNode' is not assignable to type 'ExportSpecifier'.

765                     if (map.has(node)) {
                                    ~~~~

src/compiler/compile/Component.ts:801:17 - error TS2345: Argument of type 'BaseNode' is not assignable to parameter of type 'Node'.
  Type 'BaseNode' is not assignable to type 'ExportSpecifier'.

801                     if (map.has(node)) {
                                    ~~~~

src/compiler/compile/Component.ts:802:22 - error TS2345: Argument of type 'BaseNode' is not assignable to parameter of type 'Node'.
  Type 'BaseNode' is not assignable to type 'ExportSpecifier'.

802                             scope = map.get(node);
                                                ~~~~

src/compiler/compile/Component.ts:806:67 - error TS2339: Property 'left' does not exist on type 'BaseNode'.

806                             const assignee = node.type === 'AssignmentExpression' ? node.left : node.argument;
                                                                                             ~~~~

src/compiler/compile/Component.ts:806:79 - error TS2339: Property 'argument' does not exist on type 'BaseNode'.

806                             const assignee = node.type === 'AssignmentExpression' ? node.left : node.argument;
                                                                                                         ~~~~~~~~

src/compiler/compile/Component.ts:819:30 - error TS2345: Argument of type 'BaseNode' is not assignable to parameter of type 'Node'.
  Type 'BaseNode' is not assignable to type 'ExportSpecifier'.

819                     if (is_used_as_reference(node, parent)) {
                                                 ~~~~

src/compiler/compile/Component.ts:820:32 - error TS2345: Argument of type 'BaseNode' is not assignable to parameter of type 'Node'.
  Type 'BaseNode' is not assignable to type 'ExportSpecifier'.

820                             const object = get_object(node);
                                                          ~~~~

src/compiler/compile/Component.ts:829:17 - error TS2345: Argument of type 'BaseNode' is not assignable to parameter of type 'Node'.
  Type 'BaseNode' is not assignable to type 'ExportSpecifier'.

829                     if (map.has(node)) {
                                    ~~~~

src/compiler/compile/Component.ts:897:17 - error TS2345: Argument of type 'BaseNode' is not assignable to parameter of type 'Node'.
  Type 'BaseNode' is not assignable to type 'ExportSpecifier'.

897                     if (map.has(node)) {
                                    ~~~~

src/compiler/compile/Component.ts:898:22 - error TS2345: Argument of type 'BaseNode' is not assignable to parameter of type 'Node'.
  Type 'BaseNode' is not assignable to type 'ExportSpecifier'.

898                             scope = map.get(node);
                                                ~~~~

src/compiler/compile/Component.ts:902:15 - error TS2339: Property 'kind' does not exist on type 'BaseNode'.

902                             if (node.kind === 'var' || scope === instance_scope) {
                                         ~~~~

src/compiler/compile/Component.ts:903:12 - error TS2339: Property 'declarations' does not exist on type 'BaseNode'.

903                                     node.declarations.forEach(declarator => {
                                             ~~~~~~~~~~~~

src/compiler/compile/Component.ts:970:17 - error TS2345: Argument of type 'BaseNode' is not assignable to parameter of type 'Node'.
  Type 'BaseNode' is not assignable to type 'ExportSpecifier'.

970                     if (map.has(node)) {
                                    ~~~~

src/compiler/compile/Component.ts:974:56 - error TS2339: Property 'declaration' does not exist on type 'BaseNode'.

974                     if (node.type === 'ExportNamedDeclaration' && node.declaration) {
                                                                           ~~~~~~~~~~~

src/compiler/compile/Component.ts:975:45 - error TS2339: Property 'declaration' does not exist on type 'BaseNode'.

975                             (parent as Program).body[index] = node.declaration;
                                                                       ~~~~~~~~~~~

src/compiler/compile/Component.ts:1073:18 - error TS2345: Argument of type 'BaseNode' is not assignable to parameter of type 'Node'.
  Type 'BaseNode' is not assignable to type 'ExportSpecifier'.

1073                            if (map.has(node)) {
                                            ~~~~

src/compiler/compile/Component.ts:1074:23 - error TS2345: Argument of type 'BaseNode' is not assignable to parameter of type 'Node'.
  Type 'BaseNode' is not assignable to type 'ExportSpecifier'.

1074                                    scope = map.get(node);
                                                        ~~~~

src/compiler/compile/Component.ts:1078:42 - error TS2345: Argument of type 'BaseNode' is not assignable to parameter of type 'Node'.
  Type 'BaseNode' is not assignable to type 'ExportSpecifier'.

1078                                    const { name } = flatten_reference(node);
                                                                           ~~~~

src/compiler/compile/Component.ts:1119:18 - error TS2345: Argument of type 'BaseNode' is not assignable to parameter of type 'Node'.
  Type 'BaseNode' is not assignable to type 'ExportSpecifier'.

1119                            if (map.has(node)) {
                                            ~~~~

src/compiler/compile/Component.ts:1162:19 - error TS2345: Argument of type 'BaseNode' is not assignable to parameter of type 'Node'.
  Type 'BaseNode' is not assignable to type 'ExportSpecifier'.

1162                                    if (map.has(node)) {
                                                    ~~~~

src/compiler/compile/Component.ts:1163:24 - error TS2345: Argument of type 'BaseNode' is not assignable to parameter of type 'Node'.
  Type 'BaseNode' is not assignable to type 'ExportSpecifier'.

1163                                            scope = map.get(node);
                                                                ~~~~

src/compiler/compile/Component.ts:1167:37 - error TS2339: Property 'left' does not exist on type 'BaseNode'.

1167                                            const left = get_object(node.left);
                                                                             ~~~~

src/compiler/compile/Component.ts:1174:17 - error TS2339: Property 'operator' does not exist on type 'BaseNode'.

1174                                            if (node.operator !== '=') {
                                                         ~~~~~~~~

src/compiler/compile/Component.ts:1178:43 - error TS2339: Property 'argument' does not exist on type 'BaseNode'.

1178                                            const identifier = get_object(node.argument);
                                                                                   ~~~~~~~~

src/compiler/compile/Component.ts:1181:38 - error TS2345: Argument of type 'BaseNode' is not assignable to parameter of type 'Node'.
  Type 'BaseNode' is not assignable to type 'ExportSpecifier'.

1181                                            const identifier = get_object(node);
                                                                              ~~~~

src/compiler/compile/Component.ts:1202:19 - error TS2345: Argument of type 'BaseNode' is not assignable to parameter of type 'Node'.
  Type 'BaseNode' is not assignable to type 'ExportSpecifier'.

1202                                    if (map.has(node)) {
                                                    ~~~~

src/compiler/compile/nodes/Let.ts:34:23 - error TS2339: Property 'name' does not exist on type 'BaseNode'.

34                                      names.push(node.name);
                                                        ~~~~

src/compiler/compile/nodes/shared/Expression.ts:147:17 - error TS2345: Argument of type 'BaseNode' is not assignable to parameter of type 'Node'.
  Type 'BaseNode' is not assignable to type 'ExportSpecifier'.

147                     if (map.has(node)) {
                                    ~~~~

src/compiler/compile/nodes/shared/Expression.ts:341:11 - error TS2322: Type 'BaseNode' is not assignable to type 'Node'.
  Type 'BaseNode' is missing the following properties from type 'ExportSpecifier': exported, local

341     return (this.manipulated = node);
                ~~~~~~~~~~~~~~~~

src/compiler/compile/render_dom/index.ts:199:17 - error TS2345: Argument of type 'BaseNode' is not assignable to parameter of type 'Node'.
  Type 'BaseNode' is not assignable to type 'ExportSpecifier'.

199                     if (map.has(node)) {
                                    ~~~~

src/compiler/compile/render_dom/index.ts:200:22 - error TS2345: Argument of type 'BaseNode' is not assignable to parameter of type 'Node'.
  Type 'BaseNode' is not assignable to type 'ExportSpecifier'.

200                             scope = map.get(node);
                                                ~~~~

src/compiler/compile/render_dom/index.ts:205:17 - error TS2345: Argument of type 'BaseNode' is not assignable to parameter of type 'Node'.
  Type 'BaseNode' is not assignable to type 'ExportSpecifier'.

205                     if (map.has(node)) {
                                    ~~~~

src/compiler/compile/render_dom/index.ts:210:67 - error TS2339: Property 'left' does not exist on type 'BaseNode'.

210                             const assignee = node.type === 'AssignmentExpression' ? node.left : node.argument;
                                                                                             ~~~~

src/compiler/compile/render_dom/index.ts:210:79 - error TS2339: Property 'argument' does not exist on type 'BaseNode'.

210                             const assignee = node.type === 'AssignmentExpression' ? node.left : node.argument;
                                                                                                         ~~~~~~~~

src/compiler/compile/render_dom/index.ts:218:47 - error TS2345: Argument of type 'BaseNode' is not assignable to parameter of type 'Node'.
  Type 'BaseNode' is not assignable to type 'ExportSpecifier'.

218                             this.replace(invalidate(renderer, scope, node, names));
                                                                         ~~~~

src/compiler/compile/render_dom/wrappers/EachBlock.ts:236:22 - error TS2345: Argument of type '{ block: Block; parent_node: Identifier; parent_nodes: Identifier; snippet: BaseNode; initial_anchor_node: Identifier; initial_mount_node: Identifier; update_anchor_node: Identifier; update_mount_node: Identifier; }' is not assignable to parameter of type '{ block: Block; parent_node: Identifier; parent_nodes: Identifier; snippet: Node; initial_anchor_node: Identifier; initial_mount_node: Identifier; update_anchor_node: Identifier; update_mount_node: Identifier; }'.
  Types of property 'snippet' are incompatible.
    Type 'BaseNode' is not assignable to type 'Node'.
      Type 'BaseNode' is not assignable to type 'ExportSpecifier'.

236             this.render_keyed(args);
                                  ~~~~

src/compiler/compile/render_dom/wrappers/EachBlock.ts:238:24 - error TS2345: Argument of type '{ block: Block; parent_node: Identifier; parent_nodes: Identifier; snippet: BaseNode; initial_anchor_node: Identifier; initial_mount_node: Identifier; update_anchor_node: Identifier; update_mount_node: Identifier; }' is not assignable to parameter of type '{ block: Block; parent_nodes: Identifier; snippet: Node; initial_anchor_node: Identifier; initial_mount_node: Identifier; update_anchor_node: Identifier; update_mount_node: Identifier; }'.
  Types of property 'snippet' are incompatible.
    Type 'BaseNode' is not assignable to type 'Node'.
      Type 'BaseNode' is not assignable to type 'ExportSpecifier'.

238             this.render_unkeyed(args);
                                    ~~~~

src/compiler/compile/render_dom/wrappers/Element/Binding.ts:56:3 - error TS2322: Type 'BaseNode' is not assignable to type 'Node'.
  Type 'BaseNode' is not assignable to type 'ExportSpecifier'.

56      this.snippet = this.node.expression.manipulate(block);
        ~~~~~~~~~~~~

src/compiler/compile/render_dom/wrappers/shared/Tag.ts:39:57 - error TS2345: Argument of type 'BaseNode' is not assignable to parameter of type 'Node'.
  Type 'BaseNode' is not assignable to type 'ExportSpecifier'.

39      if (this.node.should_cache) block.add_variable(value, snippet); // TODO may need to coerce snippet to string
                                                              ~~~~~~~


Found 54 errors.
btakita added a commit to btakita/svelte that referenced this issue Feb 28, 2020
@Conduitry
Copy link
Member

Can't reproduce. How did you install the dependencies? If you used Yarn, which will ignore package-lock.json, you won't get the specific versions that are used when running tests or packaging the compiler for release.

@Conduitry
Copy link
Member

I see in your PR that you added a yarn.lock, so yes that's what is happening. The stricter types are probably fine, but including yarn.lock is not.

btakita added a commit to btakita/svelte that referenced this issue Feb 28, 2020
@btakita
Copy link
Contributor Author

btakita commented Feb 28, 2020

Got it. I force pushed an update that adds yarn.lock to .gitignore.

@Conduitry
Copy link
Member

What is adding yarn.lock to gitignore intended to solve? It sounds like all that would do is let people install using Yarn (and get different dependencies) and not realize it.

@btakita
Copy link
Contributor Author

btakita commented Feb 28, 2020

So what's the solution if somebody runs yarn instead of npm install?

@btakita
Copy link
Contributor Author

btakita commented Feb 28, 2020

Google search to find this bug report or ask in discord?

btakita added a commit to btakita/svelte that referenced this issue Feb 28, 2020
@btakita
Copy link
Contributor Author

btakita commented Feb 28, 2020

I force pushed w/o yarn.lock & without having yarn.lock in .gitignore.

@Conduitry
Copy link
Member

My hope would be that they would notice git saying there's a yarn.lock where there was none before, and they'd look into it further. I don't know that there's a reasonable way to immediately error when someone runs yarn.

@btakita
Copy link
Contributor Author

btakita commented Feb 28, 2020

I added a note to not use yarn in README.md. Maybe that will help somebody

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants