Troubleshooting


Function declarations are not allowed inside blocks

Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5". 
Modules are automatically in strict mode.

This is only a problem, inside a try-catch block.
A try/catch block around a function definition does not catch exceptions thrown from that function.
You need a try/catch block either inside your function, or around the code that's actually calling the function instead.

function myFunction1() { 

  try {
    function myFunction2(arg: any) {
    }
  }
  catch (error) {
  }
}

Unexpected token. A constructor, method, accessor, or property was expected.

Unexpected token. A constructor, method, accessor, or property was expected. 

  function event_OnSave(): void { 

    this.setState({
      sDocument_Subject : this.state.sDocument_Subject
    });

    Office.context.ui.messageParent("Save");
  };



© 2021 Better Solutions Limited. All Rights Reserved. © 2021 Better Solutions Limited TopPrevNext